| Author |
java cannot find the class?
|
yub huang
Greenhorn
Joined: Jun 08, 2002
Posts: 17
|
|
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!
|
I want to know
|
 |
Ritu Kama
Ranch Hand
Joined: Sep 10, 2001
Posts: 72
|
|
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
Joined: Jan 13, 2002
Posts: 479
|
|
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.
|
Younes
By constantly trying one ends up succeeding. Thus: the more one fails the more one has a chance to succeed.
|
 |
Cindy Glass
"The Hood"
Sheriff
Joined: Sep 29, 2000
Posts: 8521
|
|
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
|
 |
yub huang
Greenhorn
Joined: Jun 08, 2002
Posts: 17
|
|
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
Joined: Jan 13, 2002
Posts: 479
|
|
|
Maybe you want to check this
|
 |
 |
|
|
subject: java cannot find the class?
|
|
|