【问题标题】:VSCode MacOS throwing libGDX -XstartOnFirstThread errorVSCode MacOS 抛出 libGDX -XstartOnFirstThread 错误
【发布时间】:2022-12-18 07:04:41
【问题描述】:

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

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 文件中,如 here 所述,但它一直向我抛出相同的错误。

我不知道这是否是 m1 mac 问题,但它适用于我的 Windows 用户朋友。

【问题讨论】:

标签: java visual-studio-code gradle libgdx


【解决方案1】:

要将 jvm 参数添加到 VSCode,请转到 VSCode 窗口中的Run &gt; Add Configurations

launch.json文件中,添加"vmArgs": "-XstartOnFirstThread"

【讨论】:

    猜你喜欢
    • 2017-05-19
    • 1970-01-01
    • 2019-03-25
    • 2021-07-23
    • 1970-01-01
    • 2019-12-11
    • 1970-01-01
    • 1970-01-01
    • 2022-11-25
    相关资源
    最近更新 更多