Search code examples
javalwjglunsatisfiedlinkerror

LWJGL wglGetCurrentContext exception


I am starting to learn LWJGL, but I'm having a problem with it. I get an error with the line GLContext.createFromCurrent(); and I can't figure out how to fix it. The first step using LWJGL I wrote my own code for creating the display, but the error popped up. Later I just copied the demonstration code from the lwjgl web page, but I have the same error. And the full error is:

Hello LWJGL 3.0.0a!
Exception in thread "main" java.lang.UnsatisfiedLinkError: org.lwjgl.opengl.WGL.wglGetCurrentContext()J
    at org.lwjgl.opengl.WGL.wglGetCurrentContext(Native Method)
    at org.lwjgl.opengl.GLContextWindows.createFromCurrent(GLContextWindows.java:59)
    at org.lwjgl.opengl.GLContext.createFromCurrent(GLContext.java:36)
    at Main.loop(Main.java:97)
    at Main.run(Main.java:26)
    at Main.main(Main.java:117)

Solution

  • As you left out the interesting half of the exception message I will just guess that you didn't set the path to LWJGL right:

    System.setProperty("org.lwjgl.librarypath", new File("pathToNatives").getAbsolutePath());
    

    For further reference see Here