简体   繁体   中英

libGDX project can't load library liblwjgl.dylib

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.

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.

也许您应该尝试将LWJGL .jar库包含在源路径或“核心”目录中。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM