Avoid using UI if we're in a headless JVM.

Closes #131.
This commit is contained in:
Michael Bayne
2018-11-26 13:26:33 -08:00
parent 4d40bc53db
commit d7ec1baa60
2 changed files with 12 additions and 0 deletions
@@ -9,6 +9,7 @@ import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.GraphicsEnvironment;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.image.BufferedImage;
@@ -67,6 +68,13 @@ public abstract class Getdown extends Thread
if (_silent) {
_launchInSilent = SysProps.launchInSilent();
}
// If we're running in a headless environment and have not otherwise customized
// silence, operate without a UI and do launch the app.
if (!_silent && GraphicsEnvironment.isHeadless()) {
log.info("Running in headless JVM, will attempt to operate without UI.");
_silent = true;
_launchInSilent = true;
}
_delay = SysProps.startDelay();
} catch (SecurityException se) {
// don't freak out, just assume non-silent and no delay; we're probably already