如何在 mac osx 上加载 libgdx 桌面应用程序?

2022-01-12 00:00:00 macos java eclipse libgdx lwjgl

我一直在我的 Windows 7 PC 上使用 libgdx 开发一个简单的游戏.最近我买了一个macbook pro(山狮).我下载并安装了 JRE 7 和 eclipse,然后克隆并导入了项目.但是,尽管在我运行桌面版本时代码中没有错误,但 JVM 加载并迅速死亡.我在控制台中得到的错误如下:

I have been developing a simple game using libgdx on my Windows 7 PC. Recently I bought a macbook pro (mountain lion). I downloaded and installed JRE 7 and eclipse, then cloned and imported the project. However though there are no errors in the code when I run the desktop version I the JVM loads and quickly dies. The error I get in the console is as follows:

JavaVM WARNING: JAWT_GetAWT must be called after loading a JVM
_NSJVMLoadLibrary: NSAddLibrary failed for /libjawt.dylib
JavaVM FATAL: lookup of function JAWT_GetAWT failed. Exit
AL lib: ReleaseALC: 1 device not closed

我已将 JRE 7 添加到构建路径库中,但仍然不满意.

I've added JRE 7 to the build path libraries, still no joy.

桌面通过此代码启动:

import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;

public class Main {
    public static void main(String[] args) {
        LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();
        cfg.title = "colourgame";
        cfg.useGL20 = false;
        cfg.width = 480;
        cfg.height = 800;
        
        new LwjglApplication(new ColourGame(), cfg);
    }
}

真的坚持这个.

推荐答案

据此http://lwjgl.org/forum/index.php/topic,4711.0.html问题在于 JRE 7 update 6 与 Lwjgl 的兼容性.

According to this http://lwjgl.org/forum/index.php/topic,4711.0.html problem is with compatibility of JRE 7 update 6 with Lwjgl.

问题似乎已在较新版本的库中得到修复.我不确定 libgdx 是否已相应更新,但您可以尝试将新版本放入您的 libs 文件夹中.

Problem seems to be fixed in a newer release of the library. I'm not sure if libgdx is updaetd accordingly but you can try to put the new version in your libs folder.

相关文章