Archived

This topic is now archived and is closed to further replies.

[java] Java Interpreter error.

This topic is 6387 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am doing a sample program from "Teach Yourself Java in 24 Hours" and the programs compile fine but I get an error when I run the interpreter stating: Exeption in Thread "main" java.lang.NoClassDefFoundErrorname of program). What does this mean I don''t know to much about threads and I am new to Java.

Share this post


Link to post
Share on other sites
A number of things can cause this error. I know since I''ve seen it a few times. You might be naming the class a different name then the filename. Or sometimes Java is too stupid to look in the same folder for a class. If you are running your programs from a dos prompt then go to the folder and type
SET CLASSPATH=.
no spaces between classpath & = & . If this is it put this line in your AUTOEXEC.bat to avoid this always. If it''s something else post the code.

Share this post


Link to post
Share on other sites
Ok. It works if I put it into the DOS prompt but what exactly do I put in the autoexec.bat file? A empty set classpath doesn''t do anything I get the same error if I don''t tell the DOS prompt to set classpath.

Share this post


Link to post
Share on other sites
path C:/jdk1.2.2/bin
SET CLASSPATH=.

This is what''s in my autoexec. The order can screw you if you have a bunch of stuff in your autoexec, but I''d put it at the top to be safer. I don''t know if you have to but capitolize SET CLASSPATH and no spaces between CLASSPATH=. By the way some systems need this line to compile any java file, some need it automatically access files in the same folder, and some systems don''t need it at all. I have gone through all three stages on my computer am puzzled why this sometimes happens

you could probably writh it like this too
path C:/jdk1.2.2/bin;SET CLASSPATH=.

Share this post


Link to post
Share on other sites