Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Setting classpath

 
Lingo Solomon
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1913
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this to JIG (beginner) forum...
Simon
 
Blake Minghelli
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic