Getting 'java.lang.UnsatisfiedLinkError': no lwjgl in java.library.path

You don't have the natives set up in your LWJGL application.

Here's how to do it:

  1. Go to your LWJGL folder that contains the folders named "jar", "res", "doc", and "native". You need to go into Eclipse (assuming you use eclipse), open your project in the Project Explorer on the left side of your screen.
  2. Right click on the "JRE System Library" of your project, and click "Build Path" -> "Configure Build Path".
  3. Include the LWJGL native libraries to your project in the Build Path Configurer by clicking the "Native library location" which can be seen in the JRE System Library dropdown menu.
  4. Click on "Edit...", which will be the only button clickable in that general area.
  5. A file explorer will pop up. Navigate to the location of your LWJGL native folder (The location should be something like "C:\Users\YOURUSERNAMEHERE\Desktop\Java\eclipse\lwjgl-2.9.0\native" if you are using Windows) and include the folder named [Your OS here].

Hope this helped :)


I was following the tutorial here, and it looks like I didn't do the Adding the natives step, or I did it incorrectly.

Follow the instructions in that link and the problem should be resolved:

This is done by clicking the little arrow next to the lwjgl.jar file to show the drop down list. Double click 'Native library location' and select the folder that contains the native files for your operating system and clicking OK. These are located in the natives folder include in the LWJGL download bundle (e.g. On Windows you'd point to the natives\windows folder which contains the *.dll files, On Mac you'd point to the natives/macosx folder and on Linux you'd point to the natives/linux folder).


If you try tu run this code:

public static void main(String... args){
    System.out.println(System.getProperty("java.library.path"));
}

you should get output like this: /Users/yourName/.sdkman/candidates/java/8.0.252.j9-adpt/jre/lib/compressedrefs:/Users/yourName/.sdkman/candidates/java/8.0.252.j9-adpt/jre/lib:/usr/lib

So, you just need to download LWJGL libraries and copy files located at "...native/yourOSname" to one of this folders

That works to me fine!