问题
With Java 8 sdk, when I do
if (SystemTray.isSupported()) {
logger.error("SystemTray IS supported");
} else {
logger.error("SystemTray IS NOT supported");
}
Why SystemTray is not supported on Windows 10 ?
And what can I do to make it supported ?
Thanks
回答1:
You can set headless property from code too:
System.setProperty("java.awt.headless", "false");
回答2:
I found the problem! My JVM was just starting in HeadLess mode!
I do not understand why... maybe because I do not have any GUI excepted this icon.
TO deactivate Headless mode, start the program with -Djava.awt.headless=false
来源:https://stackoverflow.com/questions/42420903/systemtray-not-supported-on-windows-10