PDA

View Full Version : help for java


peyoush_thakur
16-02-2008, 09:34 PM
hi ! I am using jdk 1.5 but I am not able to execute any of the program. Program gets compiled but when I try to run the program it gives :
Exception in thread "main" java.lang.NoClassDefFoundError: First
I also tried j2sdk1.4.1_01 but the problem remains the same.

redhat
16-02-2008, 09:40 PM
The following information may be usefull :

Popular Error Encountered: Some times you may encounter
an error during the execution of program.
Exception in thread “main” java.lang.NoClassDefFoundError:
filename
Solution
Go to control panel -> System -> Click on Advanced Tab then
on “Environments Variables”
Double click on classpath and specify this path —
.;c:\Progra~1\Java\jdk1.5.0\jre\lib\rt.jar;c:\prog ra~1\Java\jdk1
.5.0\lib\dt.jar

This is taken from Nitish Upreti's Book for Beginners.
Maybe It can help you...

Pathik
16-02-2008, 09:48 PM
This error most commonly occurs when you try to run the compiled program using
java file.class
or
java file.class

Or if there was an error while compiling.

If it compiled correctly use

java file

T159
16-02-2008, 11:56 PM
The following information may be usefull :

This is taken from Nitish Upreti's Book for Beginners.
Maybe It can help you...

that cant be cuz he is able to javac

post the code here.

ruturaj3
17-02-2008, 11:42 AM
May be in ur code ur class name is Sample,
And u hv save the file with sample.java.

In java, class name & file name must be same(case sensitive).

redhat
17-02-2008, 01:35 PM
that cant be cuz he is able to javac

post the code here.

Yes, You maybe be able to compile, but the class wont execute.
Has'nt it been said, "during execution"??
This does work, thanks to nitish_mythology (on this forum)