How do I use the JAVA_OPTS environment variable?

后端 未结 5 521
青春惊慌失措
青春惊慌失措 2020-12-12 16:21

How do I use the JAVA_OPTS variable to configure a web server (a linux server)?

How can I set -Djava.awt.headless=true using JAVA_OPT

5条回答
  •  再見小時候
    2020-12-12 16:34

    JAVA_OPTS is the standard environment variable that some servers and other java apps append to the call that executes the java command.

    For example in tomcat if you define JAVA_OPTS='-Xmx1024m', the startup script will execute 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

    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.

提交回复
热议问题