Customizing the environment or JVM options for Apache Tomcat
search cancel

Customizing the environment or JVM options for Apache Tomcat

book

Article ID: 297372

calendar_today

Updated On:

Products

Support Only for Apache Tomcat

Issue/Introduction

When running a Tomcat instance, the Java process starts with a default set of options. This article provides information on customising some of the commonly adjusted JVM options.

Products

Apache Tomcat 6.0.x
Apache Tomcat 7.0.x
Apache Tomcat 8.0.x

 

Resolution

Instructions

Windows

When running Apache Tomcat as a service on Windows, the JVM settings are stored in the Registry Editor at HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\Procrun 2.0\. This location contains a directory for either Tomcat 6, Tomcat 7 or Tomcat 8, which maintains a list of the parameters that can be configured. You can manually edit these values. However, this is not recommended.

 

Alternatively, you can edit these options using the Commons Daemon Service Manager tool located at %TOMCAT_HOME%\bin\tomcat7w.exe. This tools is available when you install Tomcat using the installer or by unzipping the Windows binary. This tool can also be accessed via the icon in the system tray when it is started in the monitor mode.

 

Note: When using the Tomcat Service Installer, the monitor mode is enabled by default. If you install from a ZIP archive, you can enable monitor mode by running the tomcat7w.exe //MS// command. After you run this command, you can see a new icon in the system tray.

 

To launch Commons Daemon Service Manager, double-click this icon.

After you launch the application, click the Java tab, where you can edit these values:

  • Location of the JVM that is used to launch the process
  • Java class path
  • Initial and maximum heap sizes
  • Thread stack size
  • Java system properties
  • JVM options

After making any changes to these settings you must restart the Tomcat instance for them to take effect.

Linux / Unix

When running Apache Tomcat on a Linux or Unix system, the JVM settings can be modified by creating or editing the bin/setenv.sh file. This file is intentionally omitted from Apache Tomcat downloads, so that you can make modifications to the installation and the options are not overwritten by future Tomcat upgrades.

The bin/setenv.sh file is shell script that sets any required environment variables. This table lists the commonly used environment variables and the corresponding description.

 

Option

Description

JAVA_HOME

Defines the location of the installed JDK

JRE_HOME

Defines the location of the installed JRE. If empty, defaults to the value of JAVA_HOME. If both JRE_HOME and JAVA_HOME are specified, the value of JRE_HOME is used.

CATALINA_HOME and CATALINA_BASE

Defines the location of the Tomcat installation and an optional base directory. If you are using a multiple deployment scenario, see Installing Apache Tomcat with a multi-instance layout on Linux

CATALINA_OUT

Full path to a file where stdout and stderr are written. This defaults to $CATALINA_BASE/logs/catalina.out.

CATALINA_OPTS

Java runtime options used for running the Tomcat instance. These typically include heap size, GC logging options, and JMX ports.

JAVA_OPTS

Java runtime options used for all commands to the Tomcat instance, such as start, stop, and version. In most cases, you may want to use CATALINA_OPTS instead.

CATALINA_PID

Full path to the file which should contains the process ID for the Tomcat instance.

 

©VMware 2013