Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

some problem with variable config  RSS feed

 
Max zhang
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,guys,I installed JDK 5.0 today,and I added the variable to the class path: C:\Program Files\Java\jdk1.5.0_09\lib;C:\Program Files\Java\jdk1.5.0_09\lib\tools.jar;
then I added the variable to the path: C:\Program Files\Java\jdk1.5.0_09\bin;

but..when I run a HelloJAVA through cmd,I got this: java.lang.NoClassDefFoundError:HelloJAVA,could somebody tell me what`s wrong with it?

I used to have jdk1.4.2,and it worked properly!
 
pascal betz
Ranch Hand
Posts: 547
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it is your class that needs to be on a Classpath. you can controll this trough the -classpath / -cp switch of the java command

E.g.
java -cp . mypackage.HelloJava

if you are in the root directory of your class structure.

pascal
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16028
87
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should not add the lib directory of the JDK and tools.jar to your CLASSPATH. Just remove the CLASSPATH environment variable. You do not need to set it. If it is not set, Java will by default look in the current directory for class files.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!