Detect headless JREs

Crashes caused by the missing AWT dependency come up in the support channels fairly often.
This patch detects the missing dependency and stops the server with a clear error message,
containing a link to instructions on how to install a non-headless JRE.
This commit is contained in:
Noah van der Aa
2022-10-22 14:47:45 +02:00
parent 95a2e4ed32
commit 5c260c7e51
2 changed files with 30 additions and 8 deletions

View File

@@ -20,4 +20,14 @@ public class ServerEnvironment {
public static boolean userIsRootOrAdmin() {
return RUNNING_AS_ROOT_OR_ADMIN;
}
public static String awtDependencyCheck() {
try {
new java.awt.Color(0);
} catch (UnsatisfiedLinkError e) {
return e.getClass().getName() + ": " + e.getMessage();
}
return null;
}
}