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
LVL 1
axman505Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

allahabadCommented:
Can you post the code ? and how are running it ?
0
wide_awakeCommented:
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
ExceterCommented:
>> 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
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

axman505Author Commented:


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
allahabadCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
allahabadCommented:
Could you post us your error, when you do java classFileName?
0
Mayank SAssociate Director - Product EngineeringCommented:
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
CleanupPingCommented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.