Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExceptionInInitializerError at LinuxSysImplementation #156

Closed
scrouthtv opened this issue May 18, 2020 · 2 comments
Closed

ExceptionInInitializerError at LinuxSysImplementation #156

scrouthtv opened this issue May 18, 2020 · 2 comments

Comments

@scrouthtv
Copy link

I am currently trying to get a Minecraft MDK running on Linux arch-desktop 5.6.12-arch1-1 #1 SMP PREEMPT Sun, 10 May 2020 10:43:42 +0000 x86_64 GNU/Linux.
I got this error during runtime:

[12:16:04] [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
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$3.run(Toolkit.java:1636) ~[?:1.8.0_242]
	at java.awt.Toolkit$3.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:?]

Now while this is actually somewhat an issue on Minecraft's side, I am looking for help here, because the Minecraft version I'm using is not officially supported anymore, and the error is somewhat caused by an lwjgl call (I guess)..

Some context:
net.minecraft.client.Minecraft.getSystemTime (the second to last call in the stacktrace does this`:

public static long getSystemTime() {
  return Sys.getTime() * 1000L / Sys.getTimerResolution();
}

(credit goes to Mojang or whoever did this)

where Sys is https://github.com/LWJGL/lwjgl/blob/master/src/java/org/lwjgl/Sys.java.

Following the stacktrace I found https://github.com/LWJGL/lwjgl/blob/master/src/java/org/lwjgl/LinuxSysImplementation.java#L50

so I made a little Java Program:

import java.awt.Toolkit;

Toolkit tk = java.awt.Toolkit.getDefaultToolkit();
System.out.println(tk == null);
System.out.println(tk != null ? tk.getClass() : "null");
System.out.println(System.getProperty("java.awt.headless"));

Which compiled and ran perfectly fine:

false
class sun.awt.X11.XToolkit
null

So for the same line my script doesn't throw an exception?
I included the exact same file in both scripts.

One line above there is a mention of libawt.so and libmawt.so as well as libjawt.so. I don't know where Java searches for these files, they are however located in

 ~ > locate libawt.so
/usr/lib/jvm/java-11-openjdk/lib/libawt.so
/usr/lib/jvm/java-13-openjdk/lib/libawt.so
/usr/lib/jvm/java-8-openjdk/jre/lib/amd64/libawt.so
 ~ > locate libmawt.so
 ~ > locate libjawt.so
/usr/lib/jvm/java-11-openjdk/lib/libjawt.so
/usr/lib/jvm/java-13-openjdk/lib/libjawt.so
/usr/lib/jvm/java-8-openjdk/jre/lib/amd64/libjawt.so
/usr/lib/jvm/java-8-openjdk/lib/amd64/libjawt.so

my $LD_LIBRARY_PATH is empty but I think this should only be relevant for the c compiler and not Java VM.

I found #128 suggesting that mesa is causing this problem. I have installed both mesa and the nvidia drivers, while the nvidia drivers are in use, my xorg server depends on mesa so I can't really uninstall it that easily.

I am a bit lost what I could do to move on. If there is anyone having an idea what could be causing this issue, any help would be appreciated!

@scrouthtv
Copy link
Author

 ~ > java -version
openjdk version "1.8.0_242"
OpenJDK Runtime Environment (build 1.8.0_242-b08)
OpenJDK 64-Bit Server VM (build 25.242-b08, mixed mode)

@scrouthtv
Copy link
Author

Was actually easy to fix, I just had to

export _JAVA_OPTIONS='-Dsun.java2d.opengl=true'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant