[java] Java Interpreter error.

Started by
3 comments, last by ARCHIGAMER 23 years, 10 months ago
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.
I wish there was a button on my monitor to turn up the intellegince. Theres a button called 'brightness' but it doesn't work
Advertisement
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.
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.
I wish there was a button on my monitor to turn up the intellegince. Theres a button called 'brightness' but it doesn't work
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=.
thank you very much
I wish there was a button on my monitor to turn up the intellegince. Theres a button called 'brightness' but it doesn't work

This topic is closed to new replies.

Advertisement