• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Class file not being made

 
Hon Chan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I have just installed Java and am trying to get it setup. I've set the following as the Environment variables

PATH is C:\Program Files\Java\jdk1.6.0_24\bin
CLASSPATH is C:\Program Files\Java\jdk1.6.0_24\jre\bin

I can run javac and my program compiles. I can run javac and see all the options.

But no class file is being created.

I'm using Windows 7 64 bit, i've installed using the 64 bit installer. Its created this directory as well C:\Program Files\Java\jre6\bin
I've tried setting the CLASSPATH to this but still get same problem.

 
Henry Wong
author
Marshal
Pie
Posts: 21419
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Two points...

1. CLASSPATH is for the root directories of you class files. It is *not* for you executables.

2. The compiler will place class files based on the packages it is in.


So... it would help if you tell us where the java files are located, from where you are running the compiler, and if your code uses packages.

Henry
 
Hon Chan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply Henry,

The problem with the class file is now gone, I made a silly mistake, for some reason my Java file had not saved and it was just a blank file I was compiling.

Now the class file is being created but I still got the class not found exception. I found a workaround for the problem, java -classpath . [filename] lets me run the file.

I'm running javac from the directory I have my java files saved in.
 
Greg Brannon
Bartender
Posts: 563
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hon Chan wrote:
I'm running javac from the directory I have my java files saved in.


That helps.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic