The only way to configure Tomcat 7 in 2012

Java.. and things in its ecosystem… tend to be inspirational. For instance I recently had to use Tomcat to deploy and test a few applications. One of those required more than 128MB of heap memory. Yes, by default, Tomcat 7 loads up with a Java heap size limited to 128MB. So, increasing it should be easy, right? Just a few clicks away in the documentation on the official site, right?


In 2012, Tomcat does not seem have a configuration file in which this can be edited (when I Google for something more than 15min, and don’t find it.. it probably doesn’t exist).

So people tend to hack the script, that is used to start the server up. Which is wrong. The right way is to put all the customizations into a file – in the same folder as Of course. Server configuration through shell script variables. Such intuitiveness and yet it’s the last place anyone would look. Of course, sarcasm…

So.. find your, create in the same directory and write something like this into it:

export JAVA_OPTS=”-Xms256m -Xmx1024m”

This will set initial heap size to 256MB, and maximum to 1024MB. And there you have it. Additional usable shell variables, uh.. I mean configuration options, are listed in the beginning of the, commented out with descriptions.


One thought on “The only way to configure Tomcat 7 in 2012

  1. in my console show this message:
    [tomcat@snv bin]$ /opt/tomcat/bin/ línea 2: export: `-Xmx1024m’: no es un identificador válido

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s