Link to home
Start Free TrialLog in
Avatar of axman505
axman505

asked on

Exception in thread "main" java.lang.NoClassDefFoundError

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
Avatar of allahabad
allahabad

Can you post the code ? and how are running it ?
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.
>> 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
Avatar of axman505

ASKER



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.


ASKER CERTIFIED SOLUTION
Avatar of allahabad
allahabad

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Could you post us your error, when you do java classFileName?
Avatar of Mayank S
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.
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.