Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

more changes to headless mode; now non-headless mode is used when: - YaCy runs on Windows - YaCy is started with the -gui option in all other cases YaCy runs in headless mode

orbiterb35fda43ea41
diff --git a/source/net/yacy/yacy.java b/source/net/yacy/yacy.java
index 7036446d7..78844dff5 100644
--- a/source/net/yacy/yacy.java
+++ b/source/net/yacy/yacy.java
@@ -936,12 +936,15 @@ public final class yacy {
final long startupMemFree = MemoryControl.free();
final long startupMemTotal = MemoryControl.total();
- // go into headless awt mode
- if (args.length >= 1 && args[0].toLowerCase().equals("-gui")) {
- System.setProperty("java.awt.headless", "false");
- } else {
- System.setProperty("java.awt.headless", "true");
- }
+ // maybe go into headless awt mode: we have three cases depending on OS and one exception:
+ // windows : better do not go into headless mode
+ // mac : go into headless mode because an application is shown in gui which may not be wanted
+ // linux : go into headless mode because this does not need any head operation
+ // exception : if the -gui option is used then do not go into headless mode since that uses a gui
+ boolean headless = true;
+ if (OS.isWindows) headless = false;
+ if (args.length >= 1 && args[0].toLowerCase().equals("-gui")) headless = false;
+ System.setProperty("java.awt.headless", headless ? "true" : "false");
String s = ""; for (String a: args) s += a + " ";
yacyRelease.startParameter = s.trim();