wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Setting classpath Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Setting classpath" Watch "Setting classpath" New topic
Author

Setting classpath

Lingo Solomon
Greenhorn

Joined: Dec 24, 2002
Posts: 1
HI every body,
Marry x-mass and a happy new yeay to all of you ppl.
I have downloaded j2sdk and want to run the executable programms like java , javac and other from any directory. So I set the Path variable in windows XP professional and it look working fine. But when It is giving me an error message when I run the compliled files. The message I am getting is
Exception in thread "main" java.land.NoClasseDefFoundError : C:\java\bin\nameofthefile
can some one give a little hint or some direction so that I can move on.
Thank U
Arvind Varma
Ranch Hand

Joined: Dec 24, 2002
Posts: 48
Hey Solomon,
Is this error being thrown when you use javac/java or only when you try to execute the files you have already compiled. This would be of help to answer you
Simon Brown
sharp shooter, and author
Ranch Hand

Joined: May 10, 2000
Posts: 1913
    
    6
Moving this to JIG (beginner) forum...
Simon
Blake Minghelli
Ranch Hand

Joined: Sep 13, 2002
Posts: 331
A common mistake is to not have the current directory in your CLASSPATH. Make sure that "." appears in your CLASSPATH.
Then if you cd to C:\java\bin and run "java nameofthefile" it will be able to find the class because you included the current directory in your CLASSPATH.
If you are using packages, then you need to make sure that the top-level directory is in your CLASSPATH as well.
Also, remember that any time you make a change to your env variables, you need to open a new command prompt to get the changes.


Blake Minghelli<br />SCWCD<br /> <br />"I'd put a quote here but I'm a non-conformist"
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Setting classpath