java problem
I need to do some java programming, so I installed openJDK.
The code compiles fine, but when I try to run it I get this error: Code:
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld anyone know how to fix this? |
from the error log it seems u r code is incomplete....some class definiton is missing...have a walk-thur of ur code....must be something missing....if u r stillhaving problem....reply with ur code...lets have a look over ur code..tehn it'll be easy fro nyone so say whats the issue...
was ur installation OK...all jar files added properly to the library...??? |
Looks like a hello world program. Send me it and I'll look it over - it looks like a problem with the source.
|
I don't think it's the source.
The source looks lige this Code:
It is only on this system I get the error. Other java apps run fine so I asume the java installation is ok. |
Add . to your $CLASSPATH.
|
this is my CLASSPATH
Code:
/usr/lib/jvm/java-1.6.0-openjdk/lib:/usr/lib/jvm/java-1.6.0-openjdk/jre/lib:/usr/lib/jvm/java-1.6.0-openjdk/lib:/usr/lib/jvm/java-1.6.0-openjdk/jre/lib |
Code:
usr/lib/jvm/java-1.6.0-openjdk/lib:/usr/lib/jvm/java-1.6.0-openjdk/jre/lib:/usr/lib/jvm/java-1.6.0-openjdk/lib:/usr/lib/jvm/java-1.6.0-openjdk/jre/lib:. |
Great! It works now. Thank you!
|
This is because the JVM was not able to locate your HelloWorld.class file . if you are in the directory of the class file . and you add a . against the classpath , the jvm adds the current directory path and finds your class name .
|
All times are GMT -5. The time now is 10:35 AM. |