I'm making a Java application with LWJGL following this tutorial with Eclipse, Java 15 and LWJGL 2. However, I keep getting this error:
Exception in thread "main" java.lang.UnsatisfiedLinkError:
/home/zixuan/workspace/GameEngine/lib/natives/liblwjgl64.so:
/home/zixuan/.p2/pool/plugins/org.eclipse.justj.openjdk.hotspot.jre.full.linux.x86_64_15.0.2.v20210201-0955/jre/lib/libjawt.so:
version `SUNWprivate_1.1' not found
(required by /home/zixuan/workspace/GameEngine/lib/natives/liblwjgl64.so)
This is my current buildpath organization:
I also added the native libraries:
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?
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:
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).