Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

libGDX project can't load library liblwjgl.dylib

Tags:

java

macos

libgdx

A new libGDX project can't load the library liblwjgl.dylib when running the desktop project.

Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library: 
/var/folders/4l/nsj9j4xj51g8h_6y_ndpnmc80000gn/T/libgdxChristian/3741154320/liblwjgl.dylib
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1798)
    at java.lang.Runtime.load0(Runtime.java:809)
    at java.lang.System.load(System.java:1080)
    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.openal.AL.<clinit>(AL.java:59)
    at com.badlogic.gdx.backends.openal.OpenALAudio.<init>(OpenALAudio.java:70)
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication.<init>(LwjglApplication.java:80)
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication.<init>(LwjglApplication.java:64)
    at com.foxhat.test.Main.main(Main.java:14)

Update:

I'm running Java 1.8 on OSX 10.9. The same error appears not only with an own project, but also with foreign JARs built with libGDX.

The folder mentioned in the error, where liblwjgl.dylib is searched, contains:

liblwjgl.jnilib
openal.dylib

Renaming liblwjgl.jnilib to .dylib does work for the foreign application, but not for my own.

like image 415
Appleshell Avatar asked Jan 09 '14 18:01

Appleshell


1 Answers

I believe this is a compatibility issue between Java 7 and LWJGL. For some reason, this also only affects OS X, as it works just fine on both my Windows and Ubuntu machines, but not my Mac. Your options to work with until the problem is fixed:

  • Debug on Android / Robovm
  • Code on another machine until the problem is fixed

Considering you can use an Android emulator, I think Android testing is the best option.

like image 145
Stefan Carlson Avatar answered Sep 18 '22 03:09

Stefan Carlson