jME in NetBeans

I did everything according to this tutorial:http://www.jmonkeyengine.com/wiki/doku.php?id=setting_up_netbeans_6.7_for_jme_2.0



Except instead of this:


-Djava.library.path="../jME2/jME_2.0_Complete_(r4093)/lib/natives/"



In the VM Options i wrote:

-Djava.library.path="C:Documents and SettingsFabisDesktopjME2jME2lib"



Because the latest version of jME doesn't have a natives folder.

But when i run the Hello3D file i get this:

2009.16.9 00:50:39 com.jme.app.BaseGame start
INFO: Application started.
2009.16.9 00:50:39 com.jme.system.PropertiesGameSettings <init>
INFO: PropertiesGameSettings created
2009.16.9 00:50:39 com.jme.system.PropertiesGameSettings 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:5948)
        at java.awt.Component.access$500(Component.java:169)
        at java.awt.Component$3.run(Component.java:5902)
        at java.awt.Component$3.run(Component.java:5900)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.awt.Component.checkCoalescing(Component.java:5899)
        at java.awt.Component.<init>(Component.java:5868)
        at java.awt.Container.<init>(Container.java:251)
        at java.awt.Window.<init>(Window.java:341)
        at java.awt.Window.<init>(Window.java:490)
        at java.awt.Dialog.<init>(Dialog.java:649)
        at java.awt.Dialog.<init>(Dialog.java:393)
        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>(LWJGLPropertiesDialog.java:184)
        at com.jme.app.AbstractGame$1.run(AbstractGame.java:236)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
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:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
        ... 28 more



What's wrong?

the native's are in lib/lwjgl/native/your_operating_system_here

I have followed the tutorial aswell and have had the same problem, the text in the run VM options i have now put as



-Djava.library.path="C:programmingnetbeansjME2libliblwjglnativewindows"



and i still get the same problem.

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

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



when running the HelloWorld class.

Any help greatly appreciated, thanks.

I have solved this problem now by also adding the following jar files to the project libraries:



jme-audio.jar

jme.jar

lwjgl.jar

lwjgl_util.jar



and to be safe i added:



jinput.jar

lwjgl_util_applet.jar



It now runs and I can see the cube and move about without any exceptions… without the audio jar i could see en exception in the console after exiting the graphics engine.

We should really remove that tutorial and force the netbeans users to use SVN. As long as the tutorial is not fixed we will get this complain every day.



I wonder why this problem does only seem to occur at that IDE!? Is the eclipse tutorial already fixed or are eclipse-users more familiar with svn?



That nice big red stable-download-button seems like using this would be the best sollution. But nevertheless it is just a snapshot of a heavily developed engine. We should point out on the download-side that if someone really wants to develop there is no way around using the SVN-Version…(my opinion)

Well ive checked out the source code and i can see some of the .java files i need from jmetest. I have added it to source folders, and tried adding it as a library jar file but neither works and i cannot run testPongCool for example.

It says it cant find the classes it need when im looking right at it!



Surely i dont have to add every jar file in ever subdirectory of lib? but adding the folder doesnt seem to work. Is there an easier way? thanks.

I think the biggest problem is that there a much too less NetBeans-Users (am I right with that?)

I would really like to help! (Maybe I will install it and have a look!)





[EDIT]

Well,…ok! I actually installed NetBeans and tried to use this tutorial to get it work:



http://www.jmonkeyengine.com/wiki/doku.php?id=setting_up_netbeans_6.1_for_jme_2.0



Well,…I didn't succeed with it in the beginning. Ok,…I'm not familiar with NetBeans so maybe that is the

cause why I find it not usable…Nevertheless I managed to get jME2 work.



Main Problem seems to be that Netbeans is using the maven-project-file (pom.xml) in order to locate libararies. That file is not uptodate.



Here how I did it:

  1. Follow the steps of the tutorial until:

Compile Sources

Now we compile the project, test it, and generate Javadoc.



2) Go in your jme-svn-directory and make a copy of pom.xml.
3) copy the attached pom.xml.txt to your folder and rename it to pom.xml (the forum didn't let me add .xml-files)
Attention: This pom is for windows. If using linux/mac change the swt-dependency to one of the following: "linux,macosx-carbon,macosx-carbon"

Go on with the tutorial:

#
Right click jME2 project → Click Clean and build.
#
Right click jME2 project → Click Test the project.
#
Right click jME2 project → Click Generate Javadoc.




That should have compiled your project and should be available in your {jme-path}/bin

Now right-click your project->properties, go to Run, add your jme-dir as WorkingDirectory and fill
in VM-Options for windows:

-Djava.library.path="liblwjglnativewindows"
(or replace windows through on of the following: "linux,macosx,solaris")

Now choose a test-class in MainClass you might want to see:
e.g. jmetest.TutorialGuide.HelloTerrain

Apply with ok-button.

Go to run->run project.

Hopefully that might work. Actually I tried lot the last time now and I might have forgotten a step.

Actually I'm no netbeans-user and will surley never be....I will uninstall it in 5 hours so if there are
questions ask them now.




Have a look here:

http://www.jmonkeyengine.com/forum/index.php?topic=12167.msg90536#msg90536



That might be the better choice

Okay i created a freeform project and cleaned and build successfully test and run can choose different tests from the chooser but still most files say they have errors in but i can run them. And the errors it gives it cant find symbol of a class i can see in the package right next to it?!

JulianJC said:

Okay i created a freeform project and cleaned and build successfully test and run can choose different tests from the chooser but still most files say they have errors in but i can run them. And the errors it gives it cant find symbol of a class i can see in the package right next to it?!


Have you added all four libraries you where supposed to create to your test project (from this tutorial: http://www.jmonkeyengine.com/wiki/doku.php?id=setting_up_netbeans_6.1_for_jme_2.0 )?

if you follow the above tutorial with the additions to what is said in the previous mentioned thread (my thread actually) everything should work.

Pay attention to that some imports can be wrong, in some files they import (for an example) "import flagrushtut.lesson6.Vehicle;" while in some they import them as "import jmetest.flagrushtut.lesson6.Vehicle;". If you haven't included the jmetest folder in your project the later version of the import won't work.

I've actually run into this problem now (lwjgl).



Like i said in the other thread, i run jme through a netbeans freeform project having used svn to download it, and have been doing it for over a month now with out any problems (except having to manually add jmetest stuff like you mentioned).



However, as i was checking some applet stuff, looking at BaseApplet.java, the following packages don't exist:


import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.PixelFormat;



I tried bunching the jar's JulianJC mentioned into a library and linking it to my project to no avail. I guess it needs to be compiled with jme, but i can't figure out how to add them to the freeform project.
Using ttrocha's pom.xml did not work either.
Is it somehow related to this step under the Eclipse setup?

#
Use the Add JARs button to add the following JAR files, found under workspace/jme/:

    *
      lib/jogl/gluegen-rt.jar
    *
      lib/jogl/jogl.jar
    *
      lib/jorbis/jorbis-0.0.17.jar
    *
      lib/junit/junit-4.1.jar
    *
      lib/lwjgl/jinput.jar
    *
      lib/lwjgl/lwjgl.jar
    *
      lib/lwjgl/lwjgl_util.jar
    *
      lib/lwjgl/lwjgl_util_applet.jar
    *
      lib/swt/<os>/swt.jar


Did you followed the Netbeans 6.1 tutorial?



So you have jME2-Compile and jME2-Run libs?



or what libs do you have to run Netbeans Projects with jME?



If you followed the tutorial, than just put the jME2-Run lib from the Run-Tab in your Project's library setting to the Compile tab… (delete it from the Run libraries and add it to the Compile time libraries…)

Is the reply aimed to me?

If so, yes, i have followed the tutorial, and jme builds fine. I have all the libraries from the tutorial.

The problem seems to be that the main project itself seems to be lacking those packages.

Please bear in mind that some while ago when i synced the latest, the jmetest-packages wouldn't be compiled either (sources are there, but nothing shows up in build).

I've checked the build.xml but it seems to be alright (i'm certainly no expert at interpreting .xml's though)