[Resolved]MacOS launching error

Hi,

I try to launch a basic new application. On windows, it launch as expected and display the basic view.
But on macOS high Sierra, for the exact same code and jdk (11), the setup screen appear, and after clicking on continue, this exception shutdown the application immediately:

/Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Home/bin/java "-javaagent:/Applications/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar=49896:/Applications/IntelliJ IDEA CE.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath /Users/quentinr/Projects/T4CRenewal/sources/t4c3d/renderRuntime/out/production/classes:/Users/quentinr/Projects/T4CRenewal/sources/t4c3d/renderRuntime/out/production/resources:/Users/quentinr/.gradle/caches/modules-2/files-2.1/org.jmonkeyengine/jme3-bullet-native/3.2.1-stable/9e37280adb92c5e630dd2147098291f70bc656bf/jme3-bullet-native-3.2.1-stable.jar:/Users/quentinr/.gradle/caches/modules-2/files-2.1/com.github.JavaSaBr/jmonkeybuilder-extension/2.1.1/3cb51bd591103938ebca507cda2c0f02659806e5/jmonkeybuilder-extension-2.1.1.jar:/Users/quentinr/.gradle/caches/modules-2/files-2.1/org.jmonkeyengine/jme3-bullet/3.2.1-stable/90a813795742425e147f596541d7eae4f3ccc81f/jme3-bullet-3.2.1-stable.jar:/Users/quentinr/.gradle/caches/modules-2/files-2.1/jme3utilities/SkyControl/0.9.23for33/29e337e04e1e551b6767913c98783802a54cb604/SkyControl-0.9.23for33.jar:/Users/quentinr/.gradle/caches/modules-2/files-2.1/org.jmonkeyengine/jme3-effects/3.2.1-stable/5b4a374031db7f8e38716d6ed9531b420f5baf18/jme3-effects-3.2.1-stable.jar:/Users/quentinr/.gradle/caches/modules-2/files-2.1/org.jmonkeyengine/jme3-terrain/3.2.1-stable/6d94054658b306049c9e1e77f1a65b1b1aed012a/jme3-terrain-3.2.1-stable.jar:/Users/quentinr/.gradle/caches/modules-2/files-2.1/com.github.JavaSaBr/tonegodemitter/2.4.1/5c746c85599137356383c64d5297ea4d495da2e6/tonegodemitter-2.4.1.jar:/Users/quentinr/.gradle/caches/modules-2/files-2.1/jme3utilities/jme3-utilities-heart/4.2.0for33/5e6b679e988ce75f83cf7db3261ee213b49e6649/jme3-utilities-heart-4.2.0for33.jar:/Users/quentinr/.gradle/caches/modules-2/files-2.1/org.jmonkeyengine/jme3-core/3.2.1-stable/e291222f9a6d07e52daf99e8f3b9385ddabaf1ca/jme3-core-3.2.1-stable.jar:/Users/quentinr/.gradle/caches/modules-2/files-2.1/org.jmonkeyengine/jme3-lwjgl3/3.2.1-stable/fff8c0f60572f3bf697b3762ede289db334c307d/jme3-lwjgl3-3.2.1-stable.jar:/Users/quentinr/.gradle/caches/modules-2/files-2.1/com.simsilica/zay-es/1.3.1/83a27fad918b0d97bdeb09532fa761c3bd572eb6/zay-es-1.3.1.jar:/Users/quentinr/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/15.0/d40ab99147584cf6cfb5245be67b3fee2c7220f9/annotations-15.0.jar:/Users/quentinr/.gradle/caches/modules-2/files-2.1/org.jmonkeyengine/jme3-desktop/3.2.1-stable/f569fd2d3539970309f3a44f1eb38a60800608db/jme3-desktop-3.2.1-stable.jar:/Users/quentinr/.gradle/caches/modules-2/files-2.1/org.jmonkeyengine/jme3-jogg/3.2.1-stable/2013c4dd2d2884d4f6128d2295be176dd87ace92/jme3-jogg-3.2.1-stable.jar:/Users/quentinr/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/19.0/6ce200f6b23222af3d8abb6b6459e6c44f4bb0e9/guava-19.0.jar:/Users/quentinr/.gradle/caches/modules-2/files-2.1/org.jmonkeyengine/jme3-plugins/3.2.1-stable/5131faad5c3feb1338556dbe4e51e1b0f6e64aa6/jme3-plugins-3.2.1-stable.jar:/Users/quentinr/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-api/1.7.13/7fcf30c25b8f4a9379b9dad0d3f487b25272c026/slf4j-api-1.7.13.jar:/Users/quentinr/.gradle/caches/modules-2/files-2.1/de.jarnbjo/j-ogg-all/1.0.0/c74a3afb9ec805502baf9d0f0f15d7adaf84088b/j-ogg-all-1.0.0.jar:/Users/quentinr/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-glfw/3.1.2/bc0617451b3a87e7d12a9afed68402a2b3841ad4/lwjgl-glfw-3.1.2.jar:/Users/quentinr/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-glfw/3.1.2/987e3151840ee1ed028f242dfd0894ceb0ab1073/lwjgl-glfw-3.1.2-natives-windows.jar:/Users/quentinr/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-glfw/3.1.2/3ee9ea3d30b7bfc2e4900ba8de74d145a47a44d/lwjgl-glfw-3.1.2-natives-linux.jar:/Users/quentinr/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-glfw/3.1.2/fbe42a1ccc7a9106bbf06b420aa8e96656ccf252/lwjgl-glfw-3.1.2-natives-macos.jar:/Users/quentinr/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-jemalloc/3.1.2/c11e97e9bf72c0c3c41b13c8d0b8b7652c9b9fd2/lwjgl-jemalloc-3.1.2.jar:/Users/quentinr/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-jemalloc/3.1.2/4dfc918bf703180493e2fb113c9ba2256bcc80e2/lwjgl-jemalloc-3.1.2-natives-windows.jar:/Users/quentinr/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-jemalloc/3.1.2/f2ae9aa6899ab7a26d3cc992bbf6284185dbbcca/lwjgl-jemalloc-3.1.2-natives-linux.jar:/Users/quentinr/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-jemalloc/3.1.2/6150e071e469a2fa4264b577090ae64fb029e2dc/lwjgl-jemalloc-3.1.2-natives-macos.jar:/Users/quentinr/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-openal/3.1.2/a6e7db83eac633c7bd4250b9938ed3245c83aa3e/lwjgl-openal-3.1.2.jar:/Users/quentinr/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-openal/3.1.2/c0781595de8dbc3df03f7abae00e86e6a8c2a32b/lwjgl-openal-3.1.2-natives-windows.jar:/Users/quentinr/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-openal/3.1.2/db382c4e3c72e1c8d23f5cf9e944cc45f3dbc7ec/lwjgl-openal-3.1.2-natives-linux.jar:/Users/quentinr/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-openal/3.1.2/90bfbcf111c6c1d0c6f6de9313882900cf09dba2/lwjgl-openal-3.1.2-natives-macos.jar:/Users/quentinr/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-opencl/3.1.2/eb15f404b90cf6149f0814a99a56204bcb945d0a/lwjgl-opencl-3.1.2.jar:/Users/quentinr/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-opengl/3.1.2/7c77050b72450dc06357369c73aaf76d45a3fdea/lwjgl-opengl-3.1.2.jar:/Users/quentinr/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-opengl/3.1.2/338a71484a931f938cdbefdd7348440c54d1183e/lwjgl-opengl-3.1.2-natives-windows.jar:/Users/quentinr/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-opengl/3.1.2/20d2c0a490a2c489b6fbfa50a560acdab6048cb9/lwjgl-opengl-3.1.2-natives-linux.jar:/Users/quentinr/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-opengl/3.1.2/c1ac0ab891823b4053ce74da388ce226e25bbe9b/lwjgl-opengl-3.1.2-natives-macos.jar:/Users/quentinr/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl/3.1.2/28a4511b5bc6624dbc6c579ade1b25bc2b21733e/lwjgl-3.1.2.jar:/Users/quentinr/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl/3.1.2/af9c28e4cc38f58ef34131ca3d300b985b2e265/lwjgl-3.1.2-natives-windows.jar:/Users/quentinr/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl/3.1.2/eef24025434e3c7d735744987e9330d67d06bb7f/lwjgl-3.1.2-natives-linux.jar:/Users/quentinr/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl/3.1.2/5f3cd6a9e04938a943442be68dbcdb0e9dcec486/lwjgl-3.1.2-natives-macos.jar:/Users/quentinr/.gradle/caches/modules-2/files-2.1/com.google.code.gson/gson/2.8.1/2a8e0aa38a2e21cb39e2f5a7d6704cbdc941da0/gson-2.8.1.jar com.jme.example.Main

déc. 13, 2019 7:54:12 AM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.2-stable

  • Branch: HEAD
  • Git Hash: f85624a
  • Build Date: 2018-01-21
    2019-12-13 07:54:12.535 java[43360:3339510] pid(43360)/euid(501) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
    déc. 13, 2019 7:54:12 AM com.jme3.app.LegacyApplication handleError
    SEVERE: Uncaught exception thrown in Thread[main,5,main]
    java.lang.ExceptionInInitializerError
    at org.lwjgl.glfw.GLFW.glfwShowWindow(GLFW.java:2015)
    at com.jme3.system.lwjgl.LwjglWindow.showWindow(LwjglWindow.java:307)
    at com.jme3.system.lwjgl.LwjglWindow.createContext(LwjglWindow.java:301)
    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 com.jme.example.Main.main(Main.java:10)
    Caused by: java.lang.IllegalStateException: Please run the JVM with -XstartOnFirstThread and make sure a window toolkit other than GLFW (e.g. AWT or JavaFX) is not initialized.
    at org.lwjgl.glfw.EventLoop$OnScreen.(EventLoop.java:63)
    … 10 more

Does anyone know how to resolve this issue?

I guess the solution is already provided in the stack trace:

I forgot to mention I tried the proposition but in this case, nothing happen. Like if a ghost process was launched. There is no log and no setup display.

You can also fall back to LWJGL 2. That will work without problems. This is LWJGL 3 specific problem.

1 Like

as i remember it was related to this AWT setting panel(just for MAC), right?

Im curious what if someone “get rid of this AWT panel window / replace with something else” if it will work then with LWJGL 3 on MAC?

cue 50 post thread about what “something else” is… or just search for the last one.

If you have already set -XstartOnFirstThread JVM argument then the next step is to disable settings window (it’s the Swing panel displayed when you start your game which lets you select screen resolution, Vsync, etc…).

To disable it you can do like below :

public static void main(String... args) {
        Main main = new Main();
        main.setShowSettings(false);
        main.start();
    }

note, Main is the class you extend from SimpleApplication.

1 Like

That make sense. I will try that when I come back from work and I ll let you know the outcome.

1 Like

To make it work I had to turn off the setup display and to add the “-XstartOnFirstThread” VM argument.

By only turning off the setup display, the following error is spamming the console :

ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
déc. 13, 2019 7:54:12 AM com.jme3.app.LegacyApplication handleError
SEVERE: Uncaught exception thrown in Thread[main,5,main]
java.lang.ExceptionInInitializerError

Thank you all

1 Like

With no stack trace?

That’s unfortunate if true. Developer should probably have a finger injured.

I took some time to find what was going on. I got no stack trace cause of a deadlock in the “JmeDesktopSystem” class.
This piece of code in the “showSettingsDialog” method put a lock

     synchronized (lock) {
        while (!done.get()) {
            try {
                lock.wait();
            } catch (InterruptedException ex) {
            }
        }
    }

it should be unlock when an action trigger that SelectionListener setup some instructions before in the same method

final SelectionListener selectionListener = new SelectionListener() {

        public void onSelection(int selection) {
            synchronized (lock) {
                done.set(true);
                result.set(selection);
                lock.notifyAll();
            }
        }
    };

I guess this method is trigger during an inversion of control, by clicking on somewhere. But because the setup screen never show up, I have no way to trigger the selectionListener which release the lock.

Except you did get an exception in your comment above. It just didn’t include a stack trace.

…that has nothing to do with a deadlock. Either you left the stack trace out of your post or it is somehow being swallowed by whatever is printing SEVERE: Uncaught exception thrown in Thread[main,5,main]
java.lang.ExceptionInInitializerError.

…given the format of the message, I’m going to guess you left it out.

I guess I could explained more clearly. I didn’t get any exception.
The processus is lock on the while loop and execute indefinitely the instruction:

lock.wait();

Because the done.get() return false until the onSelection instruction.
The catch clause is never reach. I know because I followed the process using a debugger.

So the exception you posted earlier was a mirage?

The exception I talked about was the one in the original situation:
It happen when I tried to launch the app with lwjgl 3 backend and not appending the jvm argument.

Them, after adding the argument, I have a new situation, without exception that I described:
-windows not showing → deadlock