Forge MDK runClient 崩溃,可能是因为 LWJGL。我该如何解决?

Forge MDK runClient crashing, likely because of LWJGL. How can I fix it?

我尝试构建 1.12.2 MDK 附带的示例 mod,gradlew setupDecompWorkspacegradlew eclipse 甚至 gradlew build 工作正常,只有当我尝试时运行 gradlew runClient 它立即崩溃并打印以下 error/stack trace:

[21:02:20] [main/ERROR] [LaunchWrapper]: Unable to launch
java.lang.reflect.InvocationTargetException: null
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_242]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_242]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_242]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_242]
        at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
        at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_242]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_242]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_242]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_242]
        at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
        at GradleStart.main(GradleStart.java:25) [start/:?]
Caused by: java.lang.ExceptionInInitializerError
        at org.lwjgl.LinuxSysImplementation.<clinit>(LinuxSysImplementation.java:50) ~[lwjgl-2.9.4-nightly-20150209.jar:?]
        at org.lwjgl.Sys.createImplementation(Sys.java:131) ~[lwjgl-2.9.4-nightly-20150209.jar:?]
        at org.lwjgl.Sys.<clinit>(Sys.java:116) ~[lwjgl-2.9.4-nightly-20150209.jar:?]
        at net.minecraft.client.Minecraft.getSystemTime(Minecraft.java:3159) ~[Minecraft.class:?]
        at net.minecraft.client.main.Main.main(Main.java:42) ~[Main.class:?]
        ... 12 more
Exception in thread "main" Caused by: java.lang.NullPointerException
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1847) ~[?:1.8.0_242]
        at java.lang.Runtime.loadLibrary0(Runtime.java:871) ~[?:1.8.0_242]
        at java.lang.System.loadLibrary(System.java:1124) ~[?:1.8.0_242]
        at java.awt.Toolkit.run(Toolkit.java:1636) ~[?:1.8.0_242]
        at java.awt.Toolkit.run(Toolkit.java:1634) ~[?:1.8.0_242]
        at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_242]
        at java.awt.Toolkit.loadLibraries(Toolkit.java:1633) ~[?:1.8.0_242]
        at java.awt.Toolkit.<clinit>(Toolkit.java:1670) ~[?:1.8.0_242]
        at org.lwjgl.LinuxSysImplementation.<clinit>(LinuxSysImplementation.java:50) ~[lwjgl-2.9.4-nightly-20150209.jar:?]
        at org.lwjgl.Sys.createImplementation(Sys.java:131) ~[lwjgl-2.9.4-nightly-20150209.jar:?]
        at org.lwjgl.Sys.<clinit>(Sys.java:116) ~[lwjgl-2.9.4-nightly-20150209.jar:?]
        at net.minecraft.client.Minecraft.getSystemTime(Minecraft.java:3159) ~[Minecraft.class:?]
        at net.minecraft.client.main.Main.main(Main.java:42) ~[Main.class:?]
        ... 12 more
[21:02:20] [main/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1052]: java.lang.reflect.InvocationTargetException
[21:02:20] [main/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1052]:        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[21:02:20] [main/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1052]:        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[21:02:20] [main/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1052]:        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[21:02:20] [main/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1052]:        at java.lang.reflect.Method.invoke(Method.java:498)
[21:02:20] [main/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1052]:        at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
[21:02:20] [main/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1052]:        at GradleStart.main(GradleStart.java:25)
[21:02:20] [main/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1061]: Caused by: net.minecraftforge.fml.relauncher.FMLSecurityManager$ExitTrappedException
[21:02:20] [main/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1061]:        at net.minecraftforge.fml.relauncher.FMLSecurityManager.checkPermission(FMLSecurityManager.java:49)
[21:02:20] [main/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1061]:        at java.lang.SecurityManager.checkExit(SecurityManager.java:761)
[21:02:20] [main/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1061]:        at java.lang.Runtime.exit(Runtime.java:108)
[21:02:20] [main/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1061]:        at java.lang.System.exit(System.java:973)
[21:02:20] [main/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1061]:        at net.minecraft.launchwrapper.Launch.launch(Launch.java:138)
[21:02:20] [main/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1061]:        at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
[21:02:20] [main/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1061]:        ... 6 more

系统信息:

但是我仍然可以从启动器 运行 (modded) Minecraft 而不会出现此错误。

我遇到了同样的问题。 seemed to be the same problem, so I tried the fix it gave - downgrade from java 1.8_242 to 1.8_232. It worked, although it was difficult to find the right java version (it was on adoptopenjdk.net)。 尝试 运行 gradle 和 java 1.8_232.

我使用

解决了同样的问题
export _JAVA_OPTIONS='-Dsun.java2d.opengl=true'