• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 269
  • Last Modified:

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.NoClassDefFoundError"
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!
0
ealry1974
Asked:
ealry1974
  • 7
  • 4
1 Solution
 
ealry1974Author Commented:
Thanks!
0
 
mErCuR4Commented:
can u show us your code??
0
 
ealry1974Author Commented:
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!
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
CEHJCommented:
Can you compile the code you gave OK on Win2K?
0
 
ealry1974Author Commented:
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.java
[parsing started d:\jdk\source\HelloDate.java]
[parsing completed 188ms]
[loading D:\jdk\jre\lib\rt.jar(java/lang/Object.class)]
[loading D:\jdk\jre\lib\rt.jar(java/lang/String.class)]
[checking HelloDate]
[loading D:\jdk\jre\lib\rt.jar(java/lang/System.class)]
[loading D:\jdk\jre\lib\rt.jar(java/io/PrintStream.class)]
[loading D:\jdk\jre\lib\rt.jar(java/io/FilterOutputStream.class)]
[loading D:\jdk\jre\lib\rt.jar(java/io/OutputStream.class)]
[loading D:\jdk\jre\lib\rt.jar(java/util/Date.class)]
[wrote d:\jdk\source\HelloDate.class]
[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!
0
 
CEHJCommented:
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!
0
 
ealry1974Author Commented:
Yeah!I did it when I installed the java. But the thing is not smooth!
0
 
CEHJCommented:
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!
0
 
ealry1974Author Commented:
Yeah!I did it when I installed the java. But the thing is not smooth!
0
 
ealry1974Author Commented:
Ok,I do it as you told me and successful!
Thanks very much!
0
 
CEHJCommented:
Thank you! Can you close the question then...
0
 
ealry1974Author Commented:
Thank you very much!CEHJ!
Good lucky!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 7
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now