简体   繁体   English

LWJGL Slick Java OS X本机

[英]LWJGL Slick Java OS X Natives

I'm trying to make a jar out of my game written with LWJGL and Slick. 我正在尝试用LWJGL和Slick编写的游戏制作一个jar。 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. 我的技术是将本地人从jar中提取到一个临时目录中,然后将org.lwjgl.librarypath更改为包含提取文件的文件夹。 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... 遗憾的是,这在OS X上不起作用...在Windows上运行正常,但在Mac上找不到“ liblwjgl.dylib”,实际上不存在...

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 大泰迪

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 . 本质上,您需要将liblwjgl.jnilib从本机目录软链接到liblwjgl.dylib That did it for me. 对我来说就做到了。

The problem is that in order for the jar to work you also need the native files. 问题在于,为了使jar正常工作,您还需要本机文件。 There is a tool called JarSplice that can allow you to put the natives inside your jars. 有一个名为JarSplice的工具,可让您将本地人放入罐子中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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