gradle VSCode MacOS引发libGDX -XstartOnFirstThread错误

7rfyedvj  于 2022-12-13  发布在  Vscode
关注(0)|答案(1)|浏览(167)

在我完成初始项目设置并运行之后,它向我抛出了这个错误

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

我试着添加jvm参数到我的build.gradle文件的run任务下,但是它一直向我抛出同样的错误。
我不知道这是否是一个m1 mac的问题,但它为我的朋友,谁是一个windows用户工作得很好.

gab6jxml

gab6jxml1#

要将jvm参数添加到VSCode,请转到VSCode窗口上的Run > Add Configurations
launch.json文件中,添加"vmArgs": "-XstartOnFirstThread"

相关问题