Noob question

Hello, I have a problem in a project created with jME2.0, if I run the project from NetBeans, adding properties of project in arguments -Djava.library.path = "C: lib native" will run fine, but when I compile and execute the file .jar does not work. How can I run the program from .Jar file directly?



Greetings


java -Djava.library.path=./lib -cp ./lib/*;./target/* packagename.TestClassName



Replace ./lib with the relative or absolute path to your native libraries
After '-cp' you need to list all additional jars which are used by the TestClass (lwjgl.jar jme.jar jme-test.jar etc etc.
if you have Java 6 you can use * as a wildcard, with java 5 you need to list every single jar.

see also http://www.jmonkeyengine.com/wiki/doku.php?id=getting_started#step_6testing_jme

I do not understand, if I put the in the VM Options -Djava.library.path = “C:libnatives” works only if I run it from NetBeans (F6).



I want to run the program from compiled .jar in dist folder, I have done the following:





I copied the natives folder in the dist folder of the project.



What arguments should I give to the netbeans VM Options to make .Jar executable? Or how to run .jar out of netbeans?

For "jME3" (if it can be called as such), the natives are stored inside the jar, and extracted/loaded when needed. This solves the "no lwjgl in java.library.path" once and for all- you might want to consider a similar approach. Consider also that if you want users to run the application by double clicking the jar, it doesn't work the same for all platforms. For example, Windows and MacOS load the natives from the working directory, while Linux doesn't.

I was thinking of adding Java class in JME that acts as dll locator and loader, it will only make sure that dlls are loaded into JVM and nothing more. Code might be put in config dialog setup where also path be coded as parameter.



This should make dll loading transparent to lwjgl, but might cause issues with lwjgl try to load dll two times.



Not sure if there is a big value in this. I will try it later.