JAVA_OPTS中无头和-D选项的含义 [英] Meaning of headless and -D option in JAVA_OPTS

查看:1008
本文介绍了JAVA_OPTS中无头和-D选项的含义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am using the following environment variable for tomcat configuration,

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

在这里我不理解-Dheadless的含义,尽管这不是强制性的,但我仍然很好奇:这是什么意思?

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?

推荐答案

TDS参考:JAVA_OPTS摘要(无效链接.已缓存此处.)

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

有关X服务器和图形渲染代码的晦涩错误可能导致WMS请求失败,或者在某些情况下导致Tomcat崩溃.您可能会看到类似以下的错误消息:

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"

为避免这种情况,需要告知图形代码没有可用的图形控制台.可以通过将java.awt.headless系统属性设置为true来完成,这可以使用JAVA_OPTS来完成:

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_OPTS中无头和-D选项的含义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆