LWJGL ‘java.lang.UnsatisfiedLinkError’: no lwjgl in java.library.path

LWJGL uses its own variables for the path to the native libraries:

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

If you kept the file structure from the LWJGL package you can use something like this:

    switch(LWJGLUtil.getPlatform())
    {
        case LWJGLUtil.PLATFORM_WINDOWS:
        {
            JGLLib = new File("./native/windows/");
        }
        break;

        case LWJGLUtil.PLATFORM_LINUX:
        {
            JGLLib = new File("./native/linux/");
        }
        break;

        case LWJGLUtil.PLATFORM_MACOSX:
        {
            JGLLib = new File("./native/macosx/");
        }
        break;
    }

    System.setProperty("org.lwjgl.librarypath", JGLLib.getAbsolutePath());

Leave a Comment