DIGIT-ARC read-only archive · snapshot: July 23, 2026

help for java

6 posts · originally from https://geek.digit.in/community/threads/help-for-java.80425/

P
peyoush_thakur Original post #1
Feb 16, 2008 at 9: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
redhat #2
Feb 16, 2008 at 9: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:\progra~1\Java\jdk1
.5.0\lib\dt.jar
This is taken from Nitish Upreti's Book for Beginners.
Maybe It can help you...
Pathik
Pathik #3
Feb 16, 2008 at 9:48 PM
This error most commonly occurs when you try to run the compiled program using
Code:
java file.class
or
Code:
java file.class

Or if there was an error while compiling.

If it compiled correctly use

Code:
java file
Faun
Faun #4
Feb 16, 2008 at 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
Feb 17, 2008 at 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
redhat #6
Feb 17, 2008 at 1: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)