[SOLVED] NoClassDefFoundError with ResourceLocator

Hi folks

Searching for NoClassDefFoundError shows me that quite a few people had similar problems. I haven't found a solution for mine however…

I copied all the jars to a subfolder [My Project]/dist/lib and launched with

$ java -Djava.library.path=./lib -cp .:lib -jar MyJar.jar

Copying the dist folder around different computers with and without Netbeans, this works with a playground project i use to try out stuff using SimplePhysicsTest.
This time, however, I started a StandardGame project and I get this Exception:

Exception in thread "main" java.lang.NoClassDefFoundError: com/jme/util/resource/ResourceLocator
Caused by: java.lang.ClassNotFoundException: com.jme.util.resource.ResourceLocator
   at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
   at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
   at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)

The ResourceLocator is one of the first thing i do in the main() method.
I unpacked the jme.jar (which is from cvs) to see if it's there... and it is... what am I doing wrong?
Thanxx in advance

modified the subject so others might find it easier...

java for dummies…

The command line I mentioned above always worked and never seemed to be a problem, although I have to admit I only wrote small helpers so far (some of them also using external libs)…

I now added every single jar in ./lib to the classpath, it works now with one exception:

When using my jar file it doesn't, still the same. But when I call the main class directly, like path.to.my.Main, all is fine.


In order for your application to be able to run for the jar file (using the -jar option of the java command), you need to add a MANIFEST file that specifies what is the main class.

You can read about it here: