我如何使用JAVA_OPTS环境变量? [英] How do I use the JAVA_OPTS environment variable?
问题描述
如何使用 JAVA_OPTS
变量来配置Web服务器(Linux服务器)?
How do I use the JAVA_OPTS
variable to configure a web server (a linux server)?
如何我可以设置 -Djava.awt.headless = true
使用 JAVA_OPTS
?
推荐答案
JAVA_OPTS
是一些标准环境变量,某些服务器和其他Java应用程序附加到执行<$的调用c $ c> java 命令。
JAVA_OPTS
is the standard environment variable that some servers and other java apps append to the call that executes the java
command.
例如在tomcat中如果定义 JAVA_OPTS =' - Xmx1024m'
,启动脚本将执行 java org.apache.tomcat.Servert -Xmx1024m
For example in tomcat if you define JAVA_OPTS='-Xmx1024m'
, the startup script will execute java org.apache.tomcat.Servert -Xmx1024m
如果你在Linux / OSX中运行,你可以在调用启动脚本之前设置JAVA_OPTS
If you are running in Linux/OSX, you can set the JAVA_OPTS, right before you call the startup script by doing
JAVA_OPTS='-Djava.awt.headless=true'
这只会在控制台打开时持续。
为了使它更加永久,你可以将它添加到〜/ .profile或〜/ .bashrc文件中。
This will only last as long as the console is open. To make it more permanent you can add it to your ~/.profile or ~/.bashrc file.
这篇关于我如何使用JAVA_OPTS环境变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!