Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (7k points)

How can I the JAVA_OPTS variable to configure a web server (in my case a Linux server)?

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

2 Answers

0 votes
by (13.1k points)

JAVA_OPTS is the standard environment variable that servers and java apps append to 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 Linux, you can set the JAVA_OPTS, right before 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

Want to learn Java? Check out the Java Certification from Intellipaat
0 votes
by (2.8k points)

JAVA_OPTS is the environment variable where servers and other Java apps append to the call which executes the java command.

For eg. in tomcat if you define JAVA_OPTS='-Xmx1024m', the script will execute java org.apache.tomcat.Servert -Xmx1024m

If you are running in Linux/OS, you can set the JAVA_OPTS, right before you call the startup script by doing

JAVA_OPTS='-Djava.awt.headless=true'

This will only be there as long as the console is open. In order to make it permanent, you can add it to your ~/.profile or ~/.bashrc file.

Related questions

0 votes
1 answer
0 votes
2 answers
0 votes
1 answer
0 votes
3 answers
asked Mar 29, 2021 in Java by dev_sk2311 (45k points)

1.2k questions

2.7k answers

501 comments

693 users

Browse Categories

...