java - JAVA_OPTS 中 headless 和 -D 选项的含义

标签 java environment-variables

我正在使用以下环境变量进行 tomcat 配置,

JAVA_OPTS="-server -Djava.awt.headless=true -Xms384M -Xmx512M -XX:MaxPermSize=256M"

这里没看懂-Dheadless是什么意思,虽然不是必须的但还是很想知道:什么意思?

最佳答案

TDS Reference: Summary of JAVA_OPTS (死链接。缓存 herehere 。)

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/

相关文章:

java - 如何在Java Spring中从Hibernate双向OneToMany ManyToOne检索数据

java - 如何使用修改日期对文件进行排序?

java - 为什么 playframework 2.0.3 在 Controller 中显示无法识别的编译错误字符?

java - 哪些环境变量会影响 'java' 二进制文件?

visual-studio-2010 - Windows 7 64位programfiles环境变量

java - 为什么 @AuthenticationPrincipal 返回 Authentication 而不是主体对象?

java - Maven 组 ID 中的 "com"是什么意思?有必要吗?

Docker:在 Dockerfile 中设置导出路径

windows - Windows 生成文件中的环境变量

c++ - 在 C++ 中访问环境变量