aspose file tools*
The moose likes Beginning Java and the fly likes Exception in thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Exception in thread "main" NoClassDefFoundError" Watch "Exception in thread "main" NoClassDefFoundError" New topic
Author

Exception in thread "main" NoClassDefFoundError

Shraga van Shufel
Ranch Hand

Joined: Apr 20, 2003
Posts: 33
Hello,
I think I am struggling with a known prob but I can't seems to figure it out.
I have a simple class and I am getting the above error when I try to run it from the command line.
when I try to run it from an IDE no problem.
public class Test {
public static void main(String [] args){
System.out.println("it works");
}
}
I set the classpath to the location of the class and also try to run the program using
# java -classpath . Test.class
if I echo the classpath I am getting to correct path
what am I doing wrong ?
thanks in advance
Shraga.
Leila Algarve
Greenhorn

Joined: Apr 13, 2003
Posts: 2
Try:
java Test
Shraga van Shufel
Ranch Hand

Joined: Apr 20, 2003
Posts: 33
10x it works fine
Stupid me
Francis Siu
Ranch Hand

Joined: Jan 04, 2003
Posts: 867
hi Shraga
Firstly, please edit your code to following which I recommand

And then save the file named
Test.java
Do you compile the programme once before run it?
if no,please do the following
javac Test.java
then run the programme
java Test
oo...
If you do the above state and can not run it,
Please feel free to let me know
thanks


Francis Siu
SCJP, MCDBA
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exception in thread "main" NoClassDefFoundError