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!
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)
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.
"JavaRanch, where the deer and the Certified play" - David O'Meara
Joined: Jun 08, 2002
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.