ealry1974
asked on
how to solve this problem?
I am a beginer of Java.
when i test the java but there is an error:
"Exception in thread "main" java.lang.NoClassDefFoundE rror"
above is the result on Win2000,but when i test the java code at UNIX,it is ok. i know this is because of my installation error but i can not find why?
Should give me help! Thanks!
when i test the java but there is an error:
"Exception in thread "main" java.lang.NoClassDefFoundE
above is the result on Win2000,but when i test the java code at UNIX,it is ok. i know this is because of my installation error but i can not find why?
Should give me help! Thanks!
can u show us your code??
ASKER
The code of this test as following:
======================
import java.util.*;
public class HelloDate {
public static void main(String[] args) {
System.out.println("Hello, it's: ");
System.out.println(new Date());
}
}
======================
thanks!
======================
import java.util.*;
public class HelloDate {
public static void main(String[] args) {
System.out.println("Hello,
System.out.println(new Date());
}
}
======================
thanks!
Can you compile the code you gave OK on Win2K?
ASKER
The following is the informations of javac,I think the trouble must be the .jar file.
************
D:\jdk\bin>javac -verbose d:\jdk\source\HelloDate.ja va
[parsing started d:\jdk\source\HelloDate.ja va]
[parsing completed 188ms]
[loading D:\jdk\jre\lib\rt.jar(java /lang/Obje ct.class)]
[loading D:\jdk\jre\lib\rt.jar(java /lang/Stri ng.class)]
[checking HelloDate]
[loading D:\jdk\jre\lib\rt.jar(java /lang/Syst em.class)]
[loading D:\jdk\jre\lib\rt.jar(java /io/PrintS tream.clas s)]
[loading D:\jdk\jre\lib\rt.jar(java /io/Filter OutputStre am.class)]
[loading D:\jdk\jre\lib\rt.jar(java /io/Output Stream.cla ss)]
[loading D:\jdk\jre\lib\rt.jar(java /util/Date .class)]
[wrote d:\jdk\source\HelloDate.cl ass]
[total 1094ms]
****************
If the complie is ok the loading should be loaded.Can you tell me why?
I use the JDK 1.4 on WIN2000.
Thannks!
************
D:\jdk\bin>javac -verbose d:\jdk\source\HelloDate.ja
[parsing started d:\jdk\source\HelloDate.ja
[parsing completed 188ms]
[loading D:\jdk\jre\lib\rt.jar(java
[loading D:\jdk\jre\lib\rt.jar(java
[checking HelloDate]
[loading D:\jdk\jre\lib\rt.jar(java
[loading D:\jdk\jre\lib\rt.jar(java
[loading D:\jdk\jre\lib\rt.jar(java
[loading D:\jdk\jre\lib\rt.jar(java
[loading D:\jdk\jre\lib\rt.jar(java
[wrote d:\jdk\source\HelloDate.cl
[total 1094ms]
****************
If the complie is ok the loading should be loaded.Can you tell me why?
I use the JDK 1.4 on WIN2000.
Thannks!
OK. First, are java and javac in your path (type path at the command line)? If not, add D:\jdk\bin to your path and while you're about it, you may as well add JAVA_HOME as d:\jdk as an environment variable. Come back when you've done it!
ASKER
Yeah!I did it when I installed the java. But the thing is not smooth!
OK, so now you need to be in the d:\jdk\source directory, not bin. Try it again from there: javac HelloDate.java (why they had to require the file extension I don't know!).
Let me know what happens!
Let me know what happens!
ASKER
Yeah!I did it when I installed the java. But the thing is not smooth!
ASKER
Ok,I do it as you told me and successful!
Thanks very much!
Thanks very much!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you very much!CEHJ!
Good lucky!
Good lucky!
ASKER