java.lang.NoClassDefFoundError: while resolving class

Hello All,

I get the following error when running the Java program, the program compiles without any problem:

Exception in thread "main" java.lang.NoClassDefFoundError: while resolving class

: PPDSBackEnd.PPDSCmdLineParser

at java.lang.VMClassLoader.resolveClass(java.lang.Class) (/usr/lib/libgcj.so.

5.0.0)

at java.lang.Class.initializeClass() (/usr/lib/libgcj.so.5.0.0)

at CPPDSScheduler.main(java.lang.String[]) (Unknown Source)

Caused by: java.lang.ClassNotFoundException: java.lang.StringBuilder not found i

n [file:/usr/share/java/libgcj-3.4.3.jar, file:./, core:/]

at java.net.URLClassLoader.findClass(java.lang.String) (/usr/lib/libgcj.so.5.

0.0)

at gnu.gcj.runtime.VMClassLoader.findClass(java.lang.String) (/usr/lib/libgcj

.so.5.0.0)

at java.lang.ClassLoader.loadClass(java.lang.String, boolean) (/usr/lib/libgc

j.so.5.0.0)

at _Jv_FindClass(_Jv_Utf8Const, java.lang.ClassLoader) (/usr/lib/libgcj.so.5.

0.0)

at java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader)

(/usr/lib/libgcj.so.5.0.0)

at _Jv_BytecodeVerifier.verify_instructions_0() (/usr/lib/libgcj.so.5.0.0)

at _Jv_VerifyMethod(_Jv_InterpMethod) (/usr/lib/libgcj.so.5.0.0)

at _Jv_PrepareClass(java.lang.Class) (/usr/lib/libgcj.so.5.0.0)

at _Jv_WaitForState(java.lang.Class, int) (/usr/lib/libgcj.so.5.0.0)

at java.lang.VMClassLoader.linkClass0(java.lang.Class) (/usr/lib/libgcj.so.5.

0.0)

at java.lang.VMClassLoader.resolveClass(java.lang.Class) (/usr/lib/libgcj.so.

5.0.0)

...2 more

It is giving an error at the line where I import my own java Package:

import PPDSBackEnd.PPDSCmdLineParser;

I have created a folder PPDSBackEnd under the current folder from where I am running the Java program.

All the .class files (that belong to PPDSBackEnd) are in the path: .\PPDSBackEnd

While compiling the .java programs that belong to PPDSBackEnd package I am using

Javac -d . <program.java>

The compiler places all the .class files correctly in the folder \PPDSBackEnd.

I tried removing all .class files and compiling again, but still it gives the same error.

This program runs fine on one Linux server, but fails on another. The other Linux server has the latest JDK installed.

Please help.

Thanks,

Vaibhav

[2482 byte] By [Vaibhav_Joshia] at [2007-11-26 13:12:03]
# 1

Make sure the classpath option in the JVM is set to include your class.

The error means the VM in unable to find the class you specified in the location that it should be in.

When you run the program, what is the context? Try running the program when the context is set to the folder containing your main class and that also contains your package.

Otherwise, try changing the output of the compiler to JAR and run the program from the JAR to see if that works better.

watertownjordana at 2007-7-7 17:28:29 > top of Java-index,Java Essentials,New To Java...
# 2

WTJ look a little harder:

> Caused by: java.lang.ClassNotFoundException: java.lang.StringBuilder not found in [file:/usr/share/java/libgcj-3.4.3.jar

You are trying to use JDK 1.5 but you have a competing installation of GNU Java on your system, which doesn't know JDK 1.5 from a hole in the ground. The best thing to do with this is to delete it now and every time you ever see one for the rest of your life. It is useless junk.

ejpa at 2007-7-7 17:28:29 > top of Java-index,Java Essentials,New To Java...
# 3
Hi I have an almost similar problem,..But I don't know how to identify and delete the "competing java installation". Would someone tell me how?
RHjavaa at 2007-7-7 17:28:29 > top of Java-index,Java Essentials,New To Java...
# 4
If you are using Windows , u can go to ControlPanel->Add Remove Programs and remove the J2se and J2re for the old one....
profilemia at 2007-7-7 17:28:29 > top of Java-index,Java Essentials,New To Java...