Java.lang.NoClassDefFoundError

Hey guys,



I am trying to get started with programming in JAVA and jME, but am having a problem running my applications in NetBeans. I have downloaded jME 1.0 source, compiled it successfully and am able to run all of the tests from the DOS-BOX. But when I try to create my own application in NetBeans (bassically a copy and paste from the Hello World tut), I get the following output when I try to run the app:



Sep 28, 2008 4:43:38 PM com.jme.app.BaseGame start

INFO: Application started.

Sep 28, 2008 4:43:38 PM com.jme.system.PropertiesIO <init>

INFO: PropertiesIO created

Sep 28, 2008 4:43:38 PM com.jme.system.PropertiesIO load

WARNING: Could not load properties. Creating a new one.

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: [Lorg/lwjgl/opengl/DisplayMode;

        at java.lang.Class.getDeclaredMethods0(Native Method)

        at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)

        at java.lang.Class.getDeclaredMethod(Class.java:1935)

        at java.awt.Component.isCoalesceEventsOverriden(Component.java:5726)

        at java.awt.Component.access$100(Component.java:162)

        at java.awt.Component$2.run(Component.java:5680)

        at java.awt.Component$2.run(Component.java:5678)

        at java.security.AccessController.doPrivileged(Native Method)

        at java.awt.Component.checkCoalescing(Component.java:5677)

        at java.awt.Component.<init>(Component.java:5646)

        at java.awt.Container.<init>(Container.java:245)

        at java.awt.Window.<init>(Window.java:320)

        at java.awt.Window.<init>(Window.java:466)

        at java.awt.Dialog.<init>(Dialog.java:654)

        at java.awt.Dialog.<init>(Dialog.java:398)

        at javax.swing.JDialog.<init>(JDialog.java:259)

        at javax.swing.JDialog.<init>(JDialog.java:193)

        at javax.swing.JDialog.<init>(JDialog.java:141)

        at com.jme.system.lwjgl.LWJGLPropertiesDialog.<init>(Unknown Source)

        at com.jme.app.AbstractGame$1.run(Unknown Source)

        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)

        at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)

        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)

        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)

        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)

        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)

        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)

        at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)

Caused by: java.lang.ClassNotFoundException: org.lwjgl.opengl.DisplayMode

        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)

        … 28 more

BUILD STOPPED (total time: 4 seconds)



The program compiles fine but doesn't run in NetBeans. I am new to JAVA and NetBeans so this is probably a stupid/simple mistake on my part but was hoping someone here could tell me what I need to do in NetBeans to get it to work. Thanks for the help.

do you have the lwjgl.jar in your classpath ?

I followed the guide at http://www.jmonkeyengine.com/wiki/doku.php?id=setting_up_netbeans_to_build_jme part e) for setting up NetBeans.



Isn't this all I need to do or do I have to actually changed the environment variables under System Properties (I am on Vista btw)?

i don't know netbeans, just make sure to add all the libraries to the project

I am having the same problem as well and i also followed the tutorial. i had no problem running the first jME2 project and running the tutorials off of that, but when i try and run them in a few project it does not work. I added the jME2-Compile and jME2-Run libraries to the project so im not sure what i am missing. i checked to see if lwjgl.jar was added to the runtime library and it is… but still getting this error

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: [Lorg/lwjgl/opengl/DisplayMode;



I am using netbeans 6.1 as well
Any help please :D?

Try to create a new JME library and add it to the project:



Create JME library:

  1. Open library manager (tools->libraries)
  2. Create new library (press "new library …")
  3. Name it JME. Keep type as "class library"
  4. Add .jar files to library. Press "Add Jar/Folder…" and select JME .jar files

      4-a) Choose all .jar files in yout jme/lib folder

      4-b) Choose all .jar files in your jme/target folder (there should be 12 .jar after you have compiled jme)



    To add the library to your project you need to select the libraries folder of your project, choose "Add library…" and select your newly created JME library.



    You should now be able to run the program. If you get linker error you need to add the folders used in 4-a and 4-b to your path environment variable.