Solved

how to solve this problem?

Posted on 2002-07-24
12
254 Views
Last Modified: 2008-01-09
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
Comment
Question by:ealry1974
  • 7
  • 4
12 Comments
 

Author Comment

by:ealry1974
ID: 7176392
Thanks!
0
 
LVL 1

Expert Comment

by:mErCuR4
ID: 7176497
can u show us your code??
0
 

Author Comment

by:ealry1974
ID: 7176512
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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 86

Expert Comment

by:CEHJ
ID: 7176537
Can you compile the code you gave OK on Win2K?
0
 

Author Comment

by:ealry1974
ID: 7176604
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
 
LVL 86

Expert Comment

by:CEHJ
ID: 7176622
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
 

Author Comment

by:ealry1974
ID: 7176653
Yeah!I did it when I installed the java. But the thing is not smooth!
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 7176667
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
 

Author Comment

by:ealry1974
ID: 7176672
Yeah!I did it when I installed the java. But the thing is not smooth!
0
 

Author Comment

by:ealry1974
ID: 7176684
Ok,I do it as you told me and successful!
Thanks very much!
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 20 total points
ID: 7176702
Thank you! Can you close the question then...
0
 

Author Comment

by:ealry1974
ID: 7176719
Thank you very much!CEHJ!
Good lucky!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
jdbc error in jsp application 20 74
tomcat startup error 5 136
pagenation logic how it is working in my code 1 71
Tagging and Merging on Branch 1 43
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question