How do I use the JAVA_OPTS
variable to configure a web server (a linux server)?
如何使用JAVA_OPTS变量配置Web服务器(Linux服务器)?
How can I set -Djava.awt.headless=true
using JAVA_OPTS
?
如何使用JAVA_OPTS设置-Djava.awt.headless = true?
5 个解决方案
#1
39
JAVA_OPTS
is the standard environment variable that some servers and other java apps append to the call that executes the java
command.
JAVA_OPTS是标准环境变量,某些服务器和其他Java应用程序附加到执行java命令的调用。
For example in tomcat if you define JAVA_OPTS='-Xmx1024m'
, the startup script will execute java org.apache.tomcat.Servert -Xmx1024m
例如在tomcat中如果定义JAVA_OPTS =' - Xmx1024m',则启动脚本将执行java org.apache.tomcat.Servert -Xmx1024m
If you are running in Linux/OSX, you can set the JAVA_OPTS, right before you call the startup script by doing
如果您在Linux / OSX中运行,则可以在调用启动脚本之前设置JAVA_OPTS
JAVA_OPTS='-Djava.awt.headless=true'
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.
只有控制台打开时,这才会持续。为了使它更永久,你可以将它添加到〜/ .profile或〜/ .bashrc文件中。
#2
11
JAVA_OPTS
is environment variable used by tomcat in its startup/shutdown script to configure params.
JAVA_OPTS是tomcat在其启动/关闭脚本中用于配置params的环境变量。
You can set it in linux by
你可以在linux中设置它
export JAVA_OPTS="-Djava.awt.headless=true"
#3
5
Just figured it out in Oracle Java the environmental variable is called: JAVA_TOOL_OPTIONS
rather than JAVA_OPTS
刚刚在Oracle Java中找到了环境变量:JAVA_TOOL_OPTIONS而不是JAVA_OPTS
#4
1
Actually, you can, even though accepted answer saying that you can't.
实际上,你可以,即使接受了答案说你做不到。
There is a _JAVA_OPTIONS
environment variable, more about it here
有一个_JAVA_OPTIONS环境变量,这里有更多关于它的信息
#5
0
JAVA_OPTS
is not restricted to Tomcat’s Java process, but passed to all JVM processes running on the same machine.
JAVA_OPTS不限于Tomcat的Java进程,而是传递给在同一台机器上运行的所有JVM进程。
Use CATALINA_OPTS
if you specifically want to pass JVM arguments to Tomcat's servlet engine.
如果您特别想将JVM参数传递给Tomcat的servlet引擎,请使用CATALINA_OPTS。
#1
39
JAVA_OPTS
is the standard environment variable that some servers and other java apps append to the call that executes the java
command.
JAVA_OPTS是标准环境变量,某些服务器和其他Java应用程序附加到执行java命令的调用。
For example in tomcat if you define JAVA_OPTS='-Xmx1024m'
, the startup script will execute java org.apache.tomcat.Servert -Xmx1024m
例如在tomcat中如果定义JAVA_OPTS =' - Xmx1024m',则启动脚本将执行java org.apache.tomcat.Servert -Xmx1024m
If you are running in Linux/OSX, you can set the JAVA_OPTS, right before you call the startup script by doing
如果您在Linux / OSX中运行,则可以在调用启动脚本之前设置JAVA_OPTS
JAVA_OPTS='-Djava.awt.headless=true'
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.
只有控制台打开时,这才会持续。为了使它更永久,你可以将它添加到〜/ .profile或〜/ .bashrc文件中。
#2
11
JAVA_OPTS
is environment variable used by tomcat in its startup/shutdown script to configure params.
JAVA_OPTS是tomcat在其启动/关闭脚本中用于配置params的环境变量。
You can set it in linux by
你可以在linux中设置它
export JAVA_OPTS="-Djava.awt.headless=true"
#3
5
Just figured it out in Oracle Java the environmental variable is called: JAVA_TOOL_OPTIONS
rather than JAVA_OPTS
刚刚在Oracle Java中找到了环境变量:JAVA_TOOL_OPTIONS而不是JAVA_OPTS
#4
1
Actually, you can, even though accepted answer saying that you can't.
实际上,你可以,即使接受了答案说你做不到。
There is a _JAVA_OPTIONS
environment variable, more about it here
有一个_JAVA_OPTIONS环境变量,这里有更多关于它的信息
#5
0
JAVA_OPTS
is not restricted to Tomcat’s Java process, but passed to all JVM processes running on the same machine.
JAVA_OPTS不限于Tomcat的Java进程,而是传递给在同一台机器上运行的所有JVM进程。
Use CATALINA_OPTS
if you specifically want to pass JVM arguments to Tomcat's servlet engine.
如果您特别想将JVM参数传递给Tomcat的servlet引擎,请使用CATALINA_OPTS。