libGDX project can't load library liblwjgl.dylib

十年热恋 提交于 2019-12-12 07:47:12

问题


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.


回答1:


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.




回答2:


Maybe you should try including the LWJGL .jar library into the source path, or the "core" directory.



来源:https://stackoverflow.com/questions/21028507/libgdx-project-cant-load-library-liblwjgl-dylib

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!