Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java cannot find the class?

 
yub huang
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After i set the JAVA_HOME:c:\%jsdk% in my windows 2000,i use "java myClass", it always say
"Exception in thread 'main' java.lang.NoClassDefFoundError".but when i use it in the other platform(windows ME),it's correct.
it confuse me.i can't find what troubles.Can somebody tell me why?
thanks a lot!
 
Ritu Kama
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is usually the case when your CLASSPATH is not set properly. Check to see that the CLASSPATH contains the directory where *myClass* is. Typically you can do something like
CLASSPATH=%CLASSPATH%;. (Add current directory to classpath)
 
Younes Essouabni
Ranch Hand
Posts: 479
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you mean that we have to add an extension to the classpath for each program that we are running in java?
I don't think so. I have the same problem and i can't resolve it.
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No - if the class that has the main method in it is not in the classpath, then you have to tell the JVM exactly where it IS. If so, I hope that you are using a .bat file or a .sh file to make this easy.
When you get around to jarring up the file, you will create a Manifest file that will tell the JVM what class to start in and what package that class is in.
 
yub huang
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the problem is the first time i install the jsdk1.4, i did not set the CLASSPATH, i can use the tool 'java'. After i install the j2sdkee1.4,
troubles comes. i start the j2sdkee, the j2ee server is normal. and i can't use the 'java' to run programs any more.
 
Younes Essouabni
Ranch Hand
Posts: 479
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe you want to check this
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic