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?
Go to "Tomcat Directory"/bin directory
if Linux then create setenv.sh else if Windows then create setenv.bat
content of setenv.* file :
after this restart tomcat with new params.
explanation and full information is here
http://crunchify.com/how-to-change-jvm-heap-setting-xms-xmx-of-tomcat/
It works even without using 'export' keyword. This is what i have in my setenv.sh (/usr/share/tomcat7/bin/setenv.sh) and it works.
OS : 14.04.1-Ubuntu Server version: Apache Tomcat/7.0.52 (Ubuntu) Server built: Jun 30 2016 01:59:37 Server number: 7.0.52.0
You might no need to having export, just add this line in catalina.sh :
Use following command to increase java heap size for tomcat7 (linux distributions) correctly:
You must not use
=
. Simply use this:Just came across this and I've implemented Nathan's solution:
add the line (changing the values as required):
to /usr/share/tomcat7/bin/setenv.sh
If that file doesn't exists then create it and
And then restart tomcat and check it with
Which should just pick up the instance and show the java parms