我正在使用以下环境变量进行 tomcat 配置,
JAVA_OPTS="-server -Djava.awt.headless=true -Xms384M -Xmx512M -XX:MaxPermSize=256M"
这里没看懂-D
和headless
是什么意思,虽然不是必须的但还是很想知道:什么意思?
最佳答案
TDS Reference: Summary of JAVA_OPTS (死链接。缓存 here 和 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
关于java - JAVA_OPTS 中 headless 和 -D 选项的含义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17501356/