tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Neven Cvetkovic <>
Subject Re: Tomcat how to set -Xms and -Xmx
Date Mon, 01 Apr 2013 02:21:28 GMT
On Sun, Mar 31, 2013 at 4:54 PM, Caldarale, Charles R <> wrote:

> > From: Harris, Jeffrey E. []
> > Subject: RE: Tomcat how to set -Xms and -Xmx
> > Add a "call setenv.bat" (with path as necessary) to startup.bat, or just
> > add the relevant SET statements directly to startup.bat.
> That's completely unnecessary, and inappropriate.  The call to setenv.bat
> is automatic.  Do not change the standard startup.bat and catalina.bat
> scripts.

+1 agreed with Charles! You should not need to change the standard
startup.bat and catalina.bat scripts, ever.

All customizations should be done through options defined in
%CATALINA_HOME%\bin\setenv.bat (or %CATALINA_BASE%\bin\setenv.bat) script.
The setenv.bat script doesn't exist by default, but catalina.bat checks for
existence of the script and calls the script if it exists, see the
following section of the default catalina.bat script:

--- catalina.bat ---
rem Get standard environment variables
if not exist "%CATALINA_BASE%\bin\setenv.bat" goto checkSetenvHome
call "%CATALINA_BASE%\bin\setenv.bat"
goto setenvDone
if exist "%CATALINA_HOME%\bin\setenv.bat" call

So, the intention is that you do all customizations are isolated in the
'setenv.bat' script, and they are separated from the standard scripts
(startup.bat, shutdown.bat, catalina.bat) - which makes the Tomcat version
updates very easy! No back-porting of the catalina.bat or startup.bat to
fit your new version of Tomcat.

There are two options that you can use to set the JVM memory options:
CATALINA_OPTS (for "start" and "run")
JAVA_OPTS (for "start", "stop" and "run")

I suggest you use CATALINA_OPTS for setting up memory, instead of using
JAVA_OPTS. The reason is that we are setting Tomcat(Catalina) options, and
we don't want to override JAVA_OPTS for some other Java applications.

Here's an example setenv.bat script:

--- setenv.bat ---
ECHO Executing setenv.bat script.

Of course, you can remove first four lines after you have successfully
tested your startup script. I would suggest you start your script with
"catalina.bat run", so you can see the output of the startup command. In
the end, startup.bat is really just "catalina.bat start". Also, check the
process manager and see the actual command line that stared the java.exe

Hope that helps!

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message