Setting java.awt.headless=true programmatically
问题 I'm trying to set java.awt.headless=true during the application startup but it appears like I'm too late and the non-headless mode has already started: static { System.setProperty("java.awt.headless", "true"); /* java.awt.GraphicsEnvironment.isHeadless() returns false */ } Is there another way set headless to true beside -Djava.awt.headless=true ? I would prefer not configure anything on the console. 回答1: I was working with a main() in a class which statically loads different parts of