From 84be38a183e5c51a5759b7a88362198b2687907c Mon Sep 17 00:00:00 2001 From: BobHanson Date: Tue, 16 Jun 2020 18:09:57 -0500 Subject: [PATCH] JAL-3659 proper headless check; skips setProperty for JS --- src/jalview/bin/Jalview.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) 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; } -- 1.7.10.2