Including jME in my Project

As already mentioned in the previous thread i finally finished my project.



Know there is a new problem. Is there any solutions to integrated the jME project into my project? Actually i added the jME project to the build path of my project. I read that it is possible to generate jars from the jME project and include those jars into my projects. is this also possible if i changed the jME source code?



or what should i do??



thx

Just a reminder … the java.library.path and the classpath are not the same thing. The classpath is where the java compiler looks for .jar files in order to compile and run. The java.library.path is where the java interpreter looks for non-java libraries which are required in order to run O.S. dependent libraries (.dll, or .so files, which frameworks like LWJGL do require). Using the command line versions of Java (javac and java), you must specify different options. The classpath is defined in the "-cp <classpath>" insertion. The java.library.path requires a "-Djava.library.path=<path_to_os_dependent_files>"  insertion. So, this is not the same as including the .dll and .so files in the classpath. Depending on your IDE (in this case Eclipse), you need to look for where the appropriate files for your O.S. are and inserting the appropriate path. I am not exactly an Eclipse user (I use Netbeans), but it seems to me that you need to look for something as a "native library location" to define the appropriate java.library.path.  I read the Wiki page on how to set up Eclipse for JME and it doesn't tell anything about that. In the JME 1.0, the .jars and .dll+.so used to be in the same directory (the lib directory), so probably Eclipse was able to locate them and use them automatically. Now, in JME 2.0, they are in a different location (the native libraries are under other directories inside the lib directory), and probably you need to set up Eclipse in the appropriate manner for it to run. Eclipse users may try to give a hint on this and correct the wiki pages on Eclipse.

gudwin said:

Eclipse users may try to give a hint on this and correct the wiki pages on Eclipse.


Just discovered a way to do that in Eclipse. Open your project Properties (right-mouse click on it and choose Properties) and then go to the "Run/Debug Settings". Edit your configuration and then choose the Arguments tab. At the VM arguments include "-Djava.library.path=<path_to_native_libs>".
This should make it work in Eclipse. Not too much intuitive ... that's why I prefer Netbeans ....

Great explanation of the difference.


gudwin said:

Just discovered a way to do that in Eclipse. Open your project Properties (right-mouse click on it and choose Properties) and then go to the "Run/Debug Settings". Edit your configuration and then choose the Arguments tab. At the VM arguments include "-Djava.library.path=<path_to_native_libs>".
This should make it work in Eclipse. Not too much intuitive ... that's why I prefer Netbeans ....

You can also right click the project, configure the build path, go to the libraries tab. Find the lwjgl jar, or library containing the jar, and define the native library location there.

edit:



if im trying to use jar files (step by step with http://www.jmonkeyengine.com/wiki/doku.php?id=setting_up_eclipse_to_build_jme)



the following errors are thrown at startup:



ava.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
   at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1709)
   at java.lang.Runtime.loadLibrary0(Runtime.java:823)
   at java.lang.System.loadLibrary(System.java:1030)
   at org.lwjgl.Sys$1.run(Sys.java:75)
   at java.security.AccessController.doPrivileged(Native Method)
   at org.lwjgl.Sys.doLoadLibrary(Sys.java:68)
   at org.lwjgl.Sys.loadLibrary(Sys.java:84)
   at org.lwjgl.Sys.<clinit>(Sys.java:101)
   at org.lwjgl.opengl.Display.<clinit>(Display.java:111)
   at com.jme.system.lwjgl.LWJGLDisplaySystem.initDisplay(Unknown Source)
   at com.jme.system.lwjgl.LWJGLDisplaySystem.createWindow(Unknown Source)
   at com.jme.app.BaseSimpleGame.initSystem(Unknown Source)
   at com.jme.app.BaseGame.start(Unknown Source)
   at controller.CP_Controller.init(CP_Controller.java:99)
   at testdriver.CP_TestDriver.main(CP_TestDriver.java:28)



and


Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class org.lwjgl.opengl.Display
   at com.jme.system.lwjgl.LWJGLDisplaySystem.close(Unknown Source)
   at com.jme.app.BaseGame.quit(Unknown Source)
   at com.jme.app.BaseSimpleGame.quit(Unknown Source)
   at com.jme.app.BaseGame.start(Unknown Source)
   at controller.CP_Controller.init(CP_Controller.java:99)
   at testdriver.CP_TestDriver.main(CP_TestDriver.java:28)

Forum search is your friend. Search for "no lwjgl in java.library.path". Hint: this means that the native (.dll|.so|…) is not on the classpath.

i did that



http://www.jmonkeyengine.com/jmeforum/index.php?topic=9041.0



already. but the some exception is thrown

Sebastian23 said:

but the some exception is thrown

Then you'll probably have to do some things to fix it.


Hint: We'll be able to give a lot more detailed answers if you provide more details about the error. A stacktrace would be a good start, and info on when the exception is thrown is a great addition.

Is this when trying to start your app from a jar outside of eclipse?