| Author |
Exception in thread "main"
|
Meet Gaurav
Ranch Hand
Joined: Oct 08, 2008
Posts: 492
|
|
While am trying to run a simple java program in UNIX machine am getting "Exception in thread "main" java.lang.NoClassDefFoundError" Even after setting export JAVA_HOME=/opt/java1.5/bin export PATH=$PATH:/opt/java1.5/bin Please assist Me.
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32599
|
|
It means you have no .class file matching the name in your current directory. Go and find the .java file for the class with the main method it, and read its package declaration. If there is no package declaration, then you need to navigate to whichever directory contains that .java file, and check there is a corresponding .class file with the ls command. If there is a package declaration, you ought not to be in the same directory as the .class file. If the .java file starts like thisyou should be in a directory which contains the directory called "com"; "com" contains "foo" and "foo" contains "bar" and the "bar" directory contains MyMainClass.class. At least it will if it has compiled correctly. You invoke the main method by writing java com.foo.bar.MyMainClass args0 args1 Try that, and make sure all the .class files are in the right locations. That error has nothing to do with the PATH variable.
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32599
|
|
|
More details here.
|
 |
Meet Gaurav
Ranch Hand
Joined: Oct 08, 2008
Posts: 492
|
|
Working Fine !!! Thanks a Lot
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32599
|
|
Originally posted by Meet Gaurav: Working Fine !!! Thanks a Lot
|
 |
 |
|
|
subject: Exception in thread "main"
|
|
|