Search code examples
javaeclipselwjgl

Eclipse can't load liblwjgl64.so


I know this has been answered before but none have worked. I tried to run a simple program,

enter code here
package tools.crystalcoffee.methods;

import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;

public class DisplayMethod {
public void createDisplay(int width, int height) {
    try {
        //Here we set the size of the Display then create it
        Display.setDisplayMode(new DisplayMode(width,height));
        Display.create();
    } catch (LWJGLException e) {

        e.printStackTrace();
    }

    // init OpenGL here

    while (!Display.isCloseRequested()) {

        // render OpenGL here

        Display.update();
    }

    Display.destroy();
    }


public static void main(String[] argv) {
    //Make a debug thing
    Debug debug = new Debug();

    debug.debug("Works");

    //Making an instance?
    DisplayMethod displayExample = new DisplayMethod();

    //Starting
    displayExample.createDisplay(100,100);
}

}

But it always throws the same error, no matter if I add the native files or not.

Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
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:135)
at tools.crystalcoffee.methods.DisplayMethod.createDisplay(DisplayMethod.java:11)
at tools.crystalcoffee.methods.DisplayMethod.main(DisplayMethod.java:38)

I have looked everywhere for an answer, for 2 hours straight and thats ALL it throws. Help?


Solution

  • Check your properties for lwjgl. I tried your program and first I got the same error (Unsatisfied link). Then if I make sure that all libraries are lwjgl 2.9.3 (get it from the legacy.lwjgl), then it works and the display starts rendering.

    The exception we had seems to be becuase we had mixed versions of lwjgl 3 and 2.

    enter image description here

    See also LWJGL Display class can't be found

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