Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Meaning of headless and -D option in JAVA_OPTS

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?

like image 843
Mateen Avatar asked Oct 20 '25 07:10

Mateen


1 Answers

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
like image 110
Suresh Atta Avatar answered Oct 21 '25 22:10

Suresh Atta