Problem loading LWJGL natives on Linux

Hi, I’m getting this error on a sample application:

[java]
[LWJGL] Xrandr extension version 1.3
[LWJGL] Using Xrandr for display mode switching
[LWJGL] XF86VidMode extension version 2.2
[LWJGL] Initial mode: 1920 x 1080 x 24 @50Hz
[LWJGL] Pixel format info: r = 8, g = 8, b = 8, a = 0, depth = 24, stencil = 0, sample buffers = 0, samples = 0
[LWJGL] MemoryUtil Accessor: AccessorUnsafe
Aug 31, 2014 8:42:15 PM com.jme3.app.Application handleError
SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.UnsatisfiedLinkError: org.lwjgl.opengl.LinuxDisplay.nSetClassHint(JJJJ)V
at org.lwjgl.opengl.LinuxDisplay.nSetClassHint(Native Method)
at org.lwjgl.opengl.LinuxDisplay.setClassHint(LinuxDisplay.java:790)
at org.lwjgl.opengl.LinuxDisplay.createWindow(LinuxDisplay.java:492)
at org.lwjgl.opengl.Display.createWindow(Display.java:306)
at org.lwjgl.opengl.Display.create(Display.java:848)
at org.lwjgl.opengl.Display.create(Display.java:757)
at com.jme3.system.lwjgl.LwjglDisplay.createContext(LwjglDisplay.java:140)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:113)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:207)
at java.lang.Thread.run(Thread.java:662)
[LWJGL] XF86VidMode extension version 2.2
[/java]

I just downloaded the latest jme release and liblwjgl64.so seems to be extracted from the jME3-lwjgl-natives.jar of that release.

Some people seem to suggest such problems could be due to the version of LWJGL instead. How can I see which version JME is pulling, and if possible, how to change it (for example by providing the natives myself) ?

Thanks for any suggestion !

You can replace the lwjgl jars provided in jmonkey with those that are in the /jar directory of the latest lwjgl release: http://sourceforge.net/projects/java-game-lib/files/Official%20Releases/LWJGL%202.9.1/lwjgl-2.9.1.zip/download

After this you have to rebuild the lwjgl-natives.jar by zipping the content of /native directory into a zip archive and rename it in .jar .

It seems that this method (nSetClassHint) was added in LWJGL version 2.9.1
The error could be explained if the version of LWJGL java sources in JME is >=2.9.1, while they bundled a liblwjgl64.so of version < 2.9.1. Is there a way to verify this ?

@Riccardo said: You can replace the lwjgl jars provided in jmonkey with those that are in the /jar directory of the latest lwjgl release: ... zipping the content of /native directory into a zip archive and rename it in .jar .

If I do this, do I have to give them particular names ? I see that the ones in JME release are all named jME3-something.jar. OR will JME somehow automagically find and use them if they’re in the class path ?

Looks like you either have lwjgl in a global java library directory and its falsely used or you somehow combined your own libraries instead of using the default SDK project and the supplied lwjgl libraries.

The supplied natives in the gitbuild work fine for example.

if the natives and the jar does not match lwjgl does a version mismatch error. Except its a very old lwjgl version that gets pulled from somewhere.
http://lwjgl.org/javadoc/org/lwjgl/Sys.html getVersion()

@normen said: Looks like you either have lwjgl in a global java library directory and its falsely used or you somehow combined your own libraries instead of using the default SDK project and the supplied lwjgl libraries.

Indeed I had a lwjgl.jar from previous experiments, in my folder “lib” (since I’m using sbt, it takes all jars in that directory). I thought that jME3-lwjgl.jar somehow replaced lwjgl.jar but actually it’s additional, and a lwjgl.jar has to be taken from JME too. For the record, JME’s is version 2.9.0 at the moment. It works now with JME’s jar.

@Empire Phoenix said: The supplied natives in the gitbuild work fine for example.

if the natives and the jar does not match lwjgl does a version mismatch error. Except its a very old lwjgl version that gets pulled from somewhere.
LWJGL - Lightweight Java Game Library getVersion()

I’m using the 3.0 release rather than a git build. I think if the versions don’t match we get the kind of funky errors I had, instead of a proper “mismatch” message :slight_smile:

The newer lwjgl test if the natives matches, but the one you had is probably from before that.

Thanks for the help