Apache Tomcat 6.0 configuration for developers

Just a quick blog on configuring some specific Tomcat 6.0 settings:

Memory Heap Size on a unix based system

Open the file %tomcat_install_folder%/bin/startup.sh

Add the line:

export CATALINA_OPTS="-Xms256m -Xmx512m"

before the line:

exec "$PRGDIR"/"$EXECUTABLE" start "$@"

to have a memory heap of at least 256mb and max of 512mb.

Memory Heap Size on a Windows based system

On a windows platform you have to set a environment variable called “CATALINA_OPTS”, with the value:

-ms128m -mx256m

You can this by right clicking the icon of your “My Computer” and then choosing properties. Under “System” I think you will then find the environment variable editor. Just add it there.

Activating servlet reloading

Open the file %tomcat_install_folder%/conf/context.xml

Change the element tag “Context” from so:

<Context>

to so:

<Context reloadable="true" privileged="true">

have fun coding webapps
eitch

3 Comments

  1. Hi h

    The suggested parameters for CATALINA_OPTS

    “-Xms256m -Xmxm”

    do not work under windows. After setting them like so, the startup.bat script of tomcat will not succeed and abords.

    The working parameters look like follows:

    “-ms128m -mx256m”

    where -ms—m marks the minimum reserved memory size and -mx—m the maximum avaliable size of memory for tomcats JVM, — stands for the desired size.

    Can u verify?

    after startup the new memory settings are visible in the tomcat manager under “status” example: http://localhost:8080/manager/status watch under title “JVM” there.

    cheers shortY

  2. ahh… rats… I mad a mistake, where I left out the number for the memory size, I added that, but it should still work with the capital X. Maybe you would like to verify this for me, as I don’t have a running Windows environment at the moment…

    greetz
    eitch

  3. Hmm… well.. it looks like you are right, so I’ll change that for windows based systems…

    For the comment readers:

    The memory needs to be changed like so:

    “-ms128m -mx256m”

Comments are closed.