Home > database >  Unsatisfied Link Error when trying to use LWJGL 2 with Eclipse
Unsatisfied Link Error when trying to use LWJGL 2 with Eclipse

Time:01-24

I'm making a Java application with LWJGL following enter image description here

I also added the native libraries:

enter image description here

Currently my folders look like this:

-GameEngine
    -src
        [sourcecode]
    -bin
        [bins]
    -lib
        -jars
            -lwjgl.jar
            -lwjgl_util.jar
            -slick-util.jar
        -natives
            -libjinput-linux64.so
            -libjinput-linux.so
            -liblwjgl64.so
            -liblwjgl.so
            -libopenal64.so
            -libopenal.so

I tried everything from changing the system library to reinstalling Eclipse, but no luck. How do I fix this?

CodePudding user response:

You are using a very very old and outdated version of LWJGL, namely version 2, together with a more modern Java/JRE version 15 shipped with Eclipse.

What will solve your issue is when you use an explicit older Java/JRE version, preferably OpenJDK 8, as that is guaranteed/tested to work with LWJGL 2. So, download an OpenJDK 8 and instruct Eclipse to use that to run your application.

It is very likely that LWJGL 2 simply does not work with any Java/JRE version higher than 8, as that is the last version tested against the last LWJGL 2 release version. While it is true that old Java code should work with newer JRE/Java versions, this promise breaks in the event of native code, which LWJGL 2 contains a lot of in order to interop with the JRE and especially its JAWT/AWT library.

So, a few dates on a timeline to get what you are doing into perspective:

  • Java 8 release date: March 2014
  • Publish date of the YT tutorial you are watching: July 2014
  • The last LWJGL 2 release (2.9.3): January 2015 ...
  • Java 15 release date: September 2020

Please keep in mind that tutorials as well as software/library versions do get outdated and eventually cease to work by becoming incompatible with an advancing/newer runtime and its provided/dependent libraries.

Again: LWJGL 2 is completely end of life for more than seven years now and will not be improved/fixed or otherwise worked on. The next version is LWJGL 3 (first version released in 2016), which is very actively being worked on and does work with even the latest JRE/Java version (OpenJDK 19 Early Access to this date).

  •  Tags:  
  • Related