How to set Java options in Tomcat

Setup Java options using GUI and command line

When running tomcat we might need to setup Java options in it . In this article we will go through on how to setup JVM (i.e Java Options) options in Tomcat 8-8.5 in windows.

In windows we can setup Java options using one of the below methods

Using Tomcat.exe gui

Go to Tomcat folder→bin and open Tomcatw.exe. This will open the GUI.

Switch to ‘Java’ tab. Put in Java Options in Java tab:

Above method is simple and straight forward, but for tomcat to pick up the Java options, we need to run Tomcat8_2.exe

If we start startup.bat tomcat wont get the Java options.

Set Java options in windows with command line. (i.e without GUI)

Sometimes, the Tomcat8_2.exe won’t run (due to various reasons), but the tomcat starts from startup.bat. For tomcat to take Java options when it runs from startup.bat we need to follow below steps.

In Tomcat bin folder create a file.

In this file set Java options in below format

CATALINA_OPTS="$CATALINA_OPTS -Dtest.var=test.value "

Above items are just an example , but setting options like above will set Java options in Tomcat.

Now if you run startup.bat tomcat will start with Java Options

So that’s how to set Java options in Tomcat. Feel free to comment any clarifications or doubts.

For more articles on Java checkout here.