Question

I'm trying to make a jar out of my game written with LWJGL and Slick. My technique is to extract the natives out of the jar into a temporary directory and then change the org.lwjgl.librarypath to the folder with the extracted files. Sadly this doesn't work on OS X... on Windows it runs fine, but on Mac it doesn't find "liblwjgl.dylib", which is actually not existing...

Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library: /var/folders/r0/qwm413fs3b9djwyb0d4pwhn40000gr/T/wo42/natives/liblwjgl.dylib
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1828)
    at java.lang.Runtime.load0(Runtime.java:792)
    at java.lang.System.load(System.java:1059)
    at org.lwjgl.Sys$1.run(Sys.java:70)
    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 org.newdawn.slick.AppGameContainer$1.run(AppGameContainer.java:39)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.newdawn.slick.AppGameContainer.<clinit>(AppGameContainer.java:36)
    at org.alternativedev.wo42.Game.run(Game.java:136)
    at org.alternativedev.wo42.App.run(App.java:32)
    at org.alternativedev.wo42.App.main(App.java:23)

Has anyone already had the same problem and/or knows the solution?

BigTeddy

Was it helpful?

Solution

The problem is that in order for the jar to work you also need the native files. There is a tool called JarSplice that can allow you to put the natives inside your jars.

OTHER TIPS

I had a similar problem and found a solution here. Essentially, you need to soft-link liblwjgl.jnilib from the natives dir to liblwjgl.dylib. That did it for me.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top