Select Page

Ubuntu 14.04 LTS (trusty)

The trick is to add (to) a file called in $CATALINA_BASE/bin which contains the appropriate JAVA_OPTS entry.

This is described in the top of the file that you should not edit:

# Control Script for the CATALINA Server
# Environment Variable Prerequisites
#   Do not set the variables in this script. Instead put them into a script
# in CATALINA_BASE/bin to keep your customizations separate.


$CATALINA_BASE was found by reading (and interpreting) /etc/init.d/tomcat7, and in this specific case was /usr/share/tomcat7. did not exist, so I created a new file with the following line in it.

JAVA_OPTS=”-Djava.awt.headless=true -Xmx1280m -XX:+UseConcMarkSweepGC”


$ sudo echo JAVA_OPTS=”-Djava.awt.headless=true -Xmx1280m -XX:+UseConcMarkSweepGC” >/usr/share/tomcat7/bin/

The existing settings were found by reading /etc/default/tomcat7, and the line above is almost the same except I have added 0 after the default 128m, so the applications I run have more room to work. The value 1280m is the memory allocated in MB. It is probably a good idea to make sure this is not so big that it cannot fit into available memory, or that there is no room for other processes. The machine in this example has 4GB of RAM, and needs space to run the tomcat based application, as well as R.

For this to take effect, restarting tomcat7 does the trick:

$ sudo /etc/init.d/tomcat7 restart




Skip to toolbar