Jalview.exit(null, 0);
}
- if (bootstrapArgs.contains(Arg.HEADLESS))
+ // new CLI
+ headlessArg = isHeadless(bootstrapArgs);
+ if (headlessArg)
{
System.setProperty("java.awt.headless", "true");
- // new
- headlessArg = bootstrapArgs.getBoolean(Arg.HEADLESS);
}
+ // old CLI
if (aparser.contains("nodisplay") || aparser.contains("nogui")
|| aparser.contains("headless"))
{
System.setProperty("java.awt.headless", "true");
- // old
headless = true;
}
// anything else!
System.out.println("[TESTOUTPUT] arg "
+ (yes ? a.argString() : a.negateArgString()) + " was set");
}
+
+ private static boolean isHeadless(BootstrapArgs bootstrapArgs)
+ {
+ if (bootstrapArgs == null)
+ {
+ return false;
+ }
+ boolean isHeadless = false;
+ if (bootstrapArgs.contains(Arg.GUI))
+ {
+ isHeadless = !bootstrapArgs.getBoolean(Arg.GUI);
+ }
+ else if (bootstrapArgs.contains(Arg.HEADLESS))
+ {
+ isHeadless = bootstrapArgs.getBoolean(Arg.HEADLESS);
+ }
+ else if (bootstrapArgs.argsHaveOption(Opt.OUTPUTFILE))
+ {
+ isHeadless = true;
+ }
+ return isHeadless;
+ }
}