So I have been developing my game in a Windows environment using IntelliJ for a few years and everything have worked well.
Just switched to a Macbook Pro, cloned my project and tried to run it in IntelliJ and I get the following error:
Exception in thread "main" java.lang.ExceptionInInitializerError
at org.lwjgl.glfw.GLFW.glfwCreateWindow(GLFW.java:1384)
at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.createGlfwWindow(Lwjgl3Application.java:425)
at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.createWindow(Lwjgl3Application.java:372)
at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lwjgl3Application.java:107)
at mygame.desktop.GameLauncher.launch(GameLauncher.java:14)
at mygame.desktop.redguyruns.gui.MainClass.main(MainClass.java:47)
Caused by: java.lang.IllegalStateException: GLFW windows may only be created on the main thread and that thread must be the first thread in the process. Please run the JVM with -XstartOnFirstThread. For offscreen rendering, make sure another window toolkit (e.g. AWT or JavaFX) is initialized before GLFW.
at org.lwjgl.glfw.EventLoop$OffScreen.<clinit>(EventLoop.java:38)
... 6 more
AL lib: (EE) alc_cleanup: 1 device not closed
The thing is that I do start my game in the main thread. mygame.desktop.GameLauncher.launch, as seen in the stack trace, is actually invoked from the main method.
Tried adding -XstartOnFirstThread as a VM argument in my run configuration, and the result was that the games launches, you hear the music for a second and then everything freezes and the window goes black.
Anyone know what’s causing this?