aspose file tools*
The moose likes Beginning Java and the fly likes my java clascompile but not run Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "my java clascompile but not run" Watch "my java clascompile but not run" New topic
Author

my java clascompile but not run

sam liya
Ranch Hand

Joined: Nov 25, 2008
Posts: 1223
i wrote a java class.and i try to compile and run it.
but it compile not run.it gives class not found error.i

i set the classpath to the java "bin".
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 19004
    
  40

i set the classpath to the java "bin".


The classpath is used to find the Java classes -- not to find the java compiler or JVM. So, unless you happen to also placed your compiled classfiles in the bin directory, this is wrong.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874



Aruna,

As Henry pointed , you should not place classes under bin.Check out this common issues
sam liya
Ranch Hand

Joined: Nov 25, 2008
Posts: 1223
no i didn't put my class files in bin director.
my class is in Desktop .I compiled it .It compiles with no errors.
but when i am goging to run it says classNoFound error.

I already have set the classpath to the java bin directory and JAVA_HOME to the JDK folder.
what is the reason for this error?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19762
    
  20

aruna sameera wrote:I already have set the classpath to the java bin directory

The PATH should include the Java bin directory, and not the CLASSPATH. That should be the directory where your class files are located (or at least the current directory, .)
sam liya
Ranch Hand

Joined: Nov 25, 2008
Posts: 1223
Thanks Rob
Finaly it works.I set the classpath tothe current Directory.
 
Don't get me started about those stupid light bulbs.
 
subject: my java clascompile but not run