File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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 liyanage
Ranch Hand

Joined: Nov 25, 2008
Posts: 1073
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: 18546
    
  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 liyanage
Ranch Hand

Joined: Nov 25, 2008
Posts: 1073
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: 19656
    
  18

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 liyanage
Ranch Hand

Joined: Nov 25, 2008
Posts: 1073
Thanks Rob
Finaly it works.I set the classpath tothe current Directory.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: my java clascompile but not run
 
Similar Threads
error in running first java code
Java ME & iOS
Compilation
problem with running the java code
Notepad with compile/Run