Home > other >  VSCode MacOS throwing libGDX -XstartOnFirstThread error
VSCode MacOS throwing libGDX -XstartOnFirstThread error

Time:12-11

After I do the initial project setup and run it is throwing this error at me

Exception in thread "main" java.lang.ExceptionInInitializerError
        at org.lwjgl.glfw.GLFW.glfwInit(GLFW.java:1046)
        at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.initializeGlfw(Lwjgl3Application.java:88)
        at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lwjgl3Application.java:138)
        at com.mygdx.game.DesktopLauncher.main(DesktopLauncher.java:13)
Caused by: java.lang.IllegalStateException: GLFW may only be used on the main thread and that thread must be the first thread in the process. Please run the JVM with -XstartOnFirstThread. This check may be disabled with Configuration.GLFW_CHECK_THREAD0.
        at org.lwjgl.glfw.EventLoop.<clinit>(EventLoop.java:30)
        ... 4 more

I tried adding adding the jvm argument as said here to my build.gradle file under run task, but It keeps throwing the same error at me.

I don't know if this is a m1 mac issue but It works fine for my friend, who is a windows user.

CodePudding user response:

To add jvm arguments to VSCode, go to Run > Add Configurations on the VSCode window

In the launch.json file, add "vmArgs": "-XstartOnFirstThread"

  • Related