When running JME3 on macOS HighSierra using the lwjgl3 runtime dependency and no VM arguments (through gradle), the application prints the following error message.
java.lang.ExceptionInInitializerError
at org.lwjgl.glfw.GLFW.glfwCreateWindow(GLFW.java:1517)
at com.jme3.system.lwjgl.LwjglWindow.createContext(LwjglWindow.java:232)
at com.jme3.system.lwjgl.LwjglWindow.initInThread(LwjglWindow.java:456)
at com.jme3.system.lwjgl.LwjglWindow.run(LwjglWindow.java:582)
at com.jme3.system.lwjgl.LwjglWindow.create(LwjglWindow.java:427)
at com.jme3.app.LegacyApplication.start(LegacyApplication.java:463)
at com.jme3.app.LegacyApplication.start(LegacyApplication.java:424)
at com.jme3.app.SimpleApplication.start(SimpleApplication.java:125)
at mcclean.jetpack.HelloJME3.main(HelloJME3.java:27)
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:37)
... 9 more
This isn’t very interesting, it’s expected rather. What is strange is the following message:
2018-03-01 16:41:22.286 java[7548:283829] !!! BUG: The current event queue and the main event queue are not the same. Events will not be handled correctly. This is probably because _TSGetMainThread was called for the first time off the main thread.
After spitting out these messages the application executes indefinitely.
When inspecting the debug perspective, the main thread is executing inside the native methodinitAppkit()
from the class sun.lawt.macosx.LWCToolkit
. (I could post what the other threads are doing but it does not seem relevant."
The most confusing behavior however is that this behavior only occurs when the SimpleApplication
property of showSettings
is set to false, and the initial settings dialog is not shown. When showSettings
is set to true, the dialog window is shown, the program displays the first exception and then exits normally and the second error message (the one about the event queue) is not printed.
This seems like an error in the java surprisingly, if not for the change in behavior when the settings dialog is shown.
Specs:
-macOS High Sierra 10.13.3 (Latest version as of post)
-JDK 9.0.1
-jMonkeyEngine 3.2-stable