Search code examples
javaeclipsemacoslibgdxlwjgl

How do I load libgdx desktop app on mac osx?


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

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

The desktop launches through this code:

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);
    }
}

Really stuck on this.


Solution

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

    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.