Take the 2-minute tour ×

I'm running Tomcat 7 on FreeBSD. I manually start it from


by executing

./tomcat7 onestart

I need to increase the heap size for one application which runs in Tomcat. I added

export JAVA_OPTS="-Xmx3000m"



but that has no effect. Deployment always fails with an out of memory exception. I edited setenv.sh but that also has no effect. For Tomcat 6 on Ubuntu 10.04 these settings worked.

What am I doing wrong?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Try looking in /usr/local/etc/rc.d/tomcat7. There is probably an option to set the heap size there that is passed directly to Java.

This is an example of my Tomcat init script which I just copied from $TOMCAT/bin/service.sh. It won't look exactly like yours as I've modified it heavily, but it should give you an idea of what you can do.

"-  Djava.util.logging.config.file="$CATALINA_HOME/conf/logging.properties"

case "$1" in
    # Start Tomcat
    $DAEMON_HOME/bin/jsvc \
    -Xms1024M -Xmx1024M \
    $JAVA_OPTS \
    -user $TOMCAT_USER \
    -home $JAVA_HOME \
    -Dcatalina.home=$CATALINA_HOME \
    -Dcatalina.base=$CATALINA_BASE \
    -Djava.io.tmpdir=$TMP_DIR \
share|improve this answer
There seems to be no service.sh in my $TOMCAT/bin. I experimented a little: if I manually start $TOMCAT/bin/startup.sh heap settings from catalina.sh are applied as I expected. –  Florian Apr 20 '12 at 8:46

Your Answer


