From: BobHanson Date: Tue, 16 Jun 2020 23:09:57 +0000 (-0500) Subject: JAL-3659 proper headless check; skips setProperty for JS X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=84be38a183e5c51a5759b7a88362198b2687907c;p=jalview.git JAL-3659 proper headless check; skips setProperty for JS --- diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index 4522167..fea99fb 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -20,6 +20,7 @@ */ package jalview.bin; +import java.awt.GraphicsEnvironment; import java.io.BufferedReader; import java.io.File; import java.io.FileOutputStream; @@ -327,15 +328,19 @@ public class Jalview implements ApplicationSingletonI showUsage(); System.exit(0); } - // ?>> + // BH note: Only -nodisplay is official; others are deprecated? if (aparser.contains("nodisplay") || aparser.contains("nogui") - || aparser.contains("headless")) + || aparser.contains("headless") + || GraphicsEnvironment.isHeadless()) { - // BH Is this necessary? Seems like a hack; was removed for applet branch - System.setProperty("java.awt.headless", "true"); + if (!isJS) { + // BH Definitely not a good idea in JavaScript; + // probably should not be here for Java, either. + System.setProperty("java.awt.headless", "true"); + } headless = true; } - if ("true".equals(System.getProperty("java.awt.headless"))) + if (GraphicsEnvironment.isHeadless()) { headless = true; }