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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user