Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Exception in thread "main" java.lang.NoClassDefFoundError

Posted on 2003-03-14
8
Medium Priority
?
644 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
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
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!

 
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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses
Course of the Month15 days, 6 hours left to enroll

577 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