Changing the Tomcat heap size under Ubuntu

I always forget this, so I’m going to write it here for future reference.

Let’s assume you have an Ubuntu server.  And you want to run Tomcat on it.  So you install it via apt-get install tomcat7.  As soon as you try deploying anything beyond the most trivial of webapps to it, you’re going to have “out of heap space” exceptions in your catalina.out log file – which, incidentally, will be in /var/lib/tomcat7/logs/

To increase the heap size, edit /etc/defaults/tomcat7 – this is where the JAVA_OPTS variable is defined.

Leave a Comment