Meaning of headless and -D option in JAVA_OPTS

environment-variables, java

Solution

TDS Reference: Summary of JAVA_OPTS (Dead link. Cached here and here.)

An obscure bug concerning X servers and graphics rendering code can cause WMS requests to fail or, in certain situations, cause Tomcat to crash. You may see error messages like the following:

"java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment"

To avoid this situation, the graphics code needs to be told that there is no graphics console available. This can be done by setting the java.awt.headless system property to true which can be done using JAVA_OPTS:

JAVA_OPTS="-Xmx1024m -Xms256m -server -Djava.awt.headless=true"
export JAVA_OPT

Problem

I am using the following environment variable for tomcat configuration, ``` JAVA_OPTS="-server -Djava.awt.headless=true -Xms384M -Xmx512M -XX:MaxPermSize=256M" ``` Here I didn't understand what is the meaning of `-D` and `headless`, although it's not mandatory I am still curious to know: what does it mean?

Original source