File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Class file not being made Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Class file not being made" Watch "Class file not being made" New topic

Class file not being made

Hon Chan

Joined: Apr 09, 2011
Posts: 2
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

Joined: Sep 28, 2004
Posts: 19926

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.


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Hon Chan

Joined: Apr 09, 2011
Posts: 2
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

Joined: Oct 24, 2010
Posts: 563
Hon Chan wrote:
I'm running javac from the directory I have my java files saved in.

That helps.

Always learning Java, currently using Eclipse on Fedora.
Linux user#: 501795
Consider Paul's rocket mass heater.
subject: Class file not being made
It's not a secret anymore!