?
Solved

Exception in thread "main" java.lang.NoClassDefFoundError

Posted on 2003-03-14
8
Medium Priority
?
643 Views
Last Modified: 2010-03-31
Hello,

I am running Windows 2K SP3 with Java SDK 1.4.0.  I get this error whenever i try to run a java app.  I can get apps to compile, but not run.  Are there any suggestions on how I can correct this error?

Thanks,


Aaron Axelsen
0
Comment
Question by:axman505
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 3

Expert Comment

by:allahabad
ID: 8141096
Can you post the code ? and how are running it ?
0
 
LVL 3

Expert Comment

by:wide_awake
ID: 8141097
when you compile the java source file, you use

javac ClassName.java


When you run the class, you use

java ClassName

*without* the .java at the end.  It sounds like the error you get when you call

java ClassName.java


-Mark.
0
 
LVL 8

Expert Comment

by:Exceter
ID: 8141400
>> I can get apps to compile, but not run.  Are there any suggestions on how I can correct this error?

What is your classpath? Check it by saying,

echo %classpath%

Try adding

;.;

to the end of the classpath. So, if your classpathh is,

c:\js2dk1.4.1_01\lib

change it to,

c:\js2dk1.4.1_01\lib;.;

Exceter
0
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 
LVL 1

Author Comment

by:axman505
ID: 8144288


E:\>echo %classpath%
"E:\Program Files\Java\j2re1.4.1\lib\ext\QTJava.zip"

I changed it to:
E:\>echo %classpath%
"e:\j2sdk1.4.0_03\lib"

However, this still fails to work

The program I use to write and compile code is Textpad.  Thanks again for all the assistance.


0
 
LVL 3

Accepted Solution

by:
allahabad earned 100 total points
ID: 8144791
Set classpath at DOS prompt:
set classpath=%classpath%;.;

cd to the directory of class file and run the class file.
java fileName
Do not put .java or .class with file name.
0
 
LVL 3

Expert Comment

by:allahabad
ID: 8144863
Could you post us your error, when you do java classFileName?
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 8149563
It might be a case problem. See that if your class name (which contains the main () method) is MyApp, then your source-file is MyApp.java, and see that when you're calling the interpreter, then you're using the correct case as:

java MyApp

Mayank.
0
 

Expert Comment

by:CleanupPing
ID: 9058681
axman505:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
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

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses
Course of the Month14 days, 12 hours left to enroll

771 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