Tomcat 7: How to set initial heap size correctly?

GLA picture GLA · Aug 1, 2011 · Viewed 229.5k times · Source

I was trying to adjust initial heap size of a tomcat 7 (CentOS, java -version: 1.6.0_25-b06) instance by adding the following line to catalina.sh:

export CATALINA_OPTS="-Xms=512M -Xmx=1024M"

Starting up tomcat fails and logs the following message to catalina.out:

Invalid initial heap size: -Xms=512m
Could not create the Java virtual machine.

What is wrong with these options?

Answer

Joachim Sauer picture Joachim Sauer · Aug 1, 2011

You must not use =. Simply use this:

export CATALINA_OPTS="-Xms512M -Xmx1024M"