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_OPTS
?
JAVA_OPTS is an environment variable that you can set to pass custom settings to the Java Virtual Machine (JVM) that runs Liquibase.
Configuring JVM OptionsAccess the Server Manager, and choose the Java tab. Click JVM Options and make the necessary changes. Click OK.
There are two ways to get the environment variable in Java, by using System properties or by using System. getEnv(). System properties provide only a limited set of predefined environment variables like java. classpath, for retrieving Java Classpath or java.
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.
Just figured it out in Oracle Java the environmental variable is called: JAVA_TOOL_OPTIONS
rather than JAVA_OPTS
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With