If you have reached this page is probably because you have seen an error message something like this :-
Native library not set - go to http://www.jmonkeyengine.com/wiki/doku.php?id=no_lwjgl_in_java.library.path for details. java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) ...
This is one of the most commonly asked questions about JME, and this Runtime error is usually a result of not following the setup instructions closely enough, or making a mistake doing so.
The root cause is that the jogl (Java OpenGL) and lwjgl libraries (Light-weight Java Graphics Library) come in two parts:
You recognize native dynamic libraries by suffixes such as .dll, .so, .dylib, .jnilib. Natives enable the Java framework to access the operating system's OpenGL drivers, and you cannot go without them when developing a platform-independent JME app. JME includes all necessary natives for the major operating systems (Windows (32/64 bit), Linux (32/64 bit), Mac OS X, Solaris) – but you need to link them correctly.
There are a number of different ways of correctly specifying the location of the native libraries:
The preferred way is to set it on the lwjgl.jar library as described below and in the Eclipse Guide for jME - step 10.
Assuming you have already added the lwjgl.jar to your project - locate it in the libraries (project properties → java build path → libraries tab. Now expand the branch, and you should see “Native library location”. Select this, then click edit. Now click workspace, and browse to you JME project → lib → lwjgl → native → <whatever OS you are using> either linux, macosx, solaris or windows.
Open the Project Properties, go to the Run section, and add your -Djava.library.path=”…” to the VM options. The path should point to the directories that contain the natives.
See the guide for setting up netbeans 6.7 for jme 2.0 or setting up netbeans 6.7 for jme 2.0.1 (all netbeans tutorials)
Another way of linking to native dynamic libraries is to add the path to the java command line arguments.
java -jar MyGame.jar -Djava.library.path=${JME-dir}/lib/lwjgl/native/${operating-system}/
Note: For JME 2.0.1, the native libraries are spread over several directories. So the Java library path must contain a list of all these directories. Use a colon for concatenation. If you link all natives, it may look like this:
-Djava.library.path="../jME2_0_1-Stable/lib/lib/lwjgl/native/macosx/:../jME2_0_1-Stable/lib/lib/jogl/native/macosx/:../jME2_0_1-Stable/lib/lib/lwjgl/native/linux_amd64/:../jME2_0_1-Stable/lib/lib/jogl/native/linux_amd64/:../jME2_0_1-Stable/lib/lib/lwjgl/native/linux_i586/:../jME2_0_1-Stable/lib/lib/jogl/native/linux_i586/:../jME2_0_1-Stable/lib/lib/lwjgl/native/solaris_i586/:../jME2_0_1-Stable/lib/lib/jogl/native/solaris_i586/:../jME2_0_1-Stable/lib/lib/lwjgl/native/windows_amd64/:../jME2_0_1-Stable/lib/lib/jogl/native/windows_amd64/:../jME2_0_1-Stable/lib/lib/lwjgl/native/windows_i586/:../jME2_0_1-Stable/lib/lib/jogl/native/windows_i586/"
If you still cannot get it working - please search the forum and the wiki before asking this question again. There are at least a dozen separate threads detailing every possible variation of this issue. Thank you.