I guess many people think this question has duplicated ones. However, this question precisely asks
how can I run Java where !GraphicsEnvironment.isHeadless()
returns true
The answer would be like
java --gui=disabled -jar hoge.jar
I guess many people think this question has duplicated ones. However, this question precisely asks
how can I run Java where !GraphicsEnvironment.isHeadless()
returns true
The answer would be like
java --gui=disabled -jar hoge.jar
The commandline parameter -Djava.awt.headless=true
can be used to set the headless mode from the commandline.
The linked question shows ways to set it programmatically, which is somewhat trickier but may be preferrable if you don't want or can't access the commandline parameters.