Search code examples
javanetbeanslwjgl

lwjgl UnsatisfiedLink error


I know this may seem like a duplicate but throughout the examples I have seem I must be doing something wrong still.

I am using Netbeans 8.0.

Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1865)
    at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    at java.lang.System.loadLibrary(System.java:1119)
    at org.lwjgl.Sys$1.run(Sys.java:73)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
    at org.lwjgl.Sys.loadLibrary(Sys.java:95)
    at org.lwjgl.Sys.<clinit>(Sys.java:112)
    at org.lwjgl.opengl.Display.<clinit>(Display.java:132)
    at org.newdawn.slick.AppGameContainer$1.run(AppGameContainer.java:39)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.newdawn.slick.AppGameContainer.<clinit>(AppGameContainer.java:36)
    at Engine.main(Engine.java:33)

Is my error which i know from research is just the path isn't set. I went into Properties > Libraries and i have a Library LWJGL which has multiple .jar's in it, including lwjgl.jar. I also have gone to Properties > Run which is where i believe my problem is. I have made a folder in C:\LWJGL\ that contains the lwjgl.jar aswell. My VM Options are -Djava.library.path=C:\LWJGL\.

I know i must be missing something here in regards to where is it looking for the native files or something? After reading through other posts i think my problem is the location of the native files.


Solution

  • java.library.path takes the path to the natives (extensions .dll, .so, .dylib), not the jar file. You have to point it directly to the folder where you have stored these files; it won't work when they are in a subfolder. The LWJGL zip file you downloaded will most likely contain a native folder that contains these files.