In which file do the export JAVA_OPTS="" Parameters go?
Solution 1
The startup scripts of tomcat will run a setenv.sh
file if it exists. Create it (in the tomcat bin/
) directory and write your customization there, e.g. that file can just contain the line:
export JAVA_OPTS="-Xms756m -Xmx756m -Xss128m -Xmn512m"
Solution 2
when you do it from the command line, the params are not written anywhere. They exist only for your current bash session.
Put export JAVA_OPTS="..."
in your ~/.bashrc or ~/.bash_profile files to persist them. If you are on OS X you will have to source the .bashrc file from .profile.
Solution 3
simply add it under startup.sh
like this
export JAVA_OPTS="-server -Xms2048M -Xmx2048M -XX:MaxPermSize=128M"
Hope it works.
Solution 4
Those values will be used by catalina.sh, e.g.
"$_RUNJAVA" "$LOGGING_CONFIG" $JAVA_OPTS $CATALINA_OPTS \
-Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
-Dcatalina.base="$CATALINA_BASE" \
-Dcatalina.home="$CATALINA_HOME" \
-Djava.io.tmpdir="$CATALINA_TMPDIR" \
org.apache.catalina.startup.Bootstrap "$@" start \
>> "$CATALINA_OUT" 2>&1 &
So if you export that variable and then start Tomcat in the same console (e.g. using "catalina start" or "startup") then the JVM will be created with those parameters.
Solution 5
The statement just assigns the environment variable JAVA_OPTS the given value. There is no file involved here.
Later JAVA_OPTS maybe passed to the command line of java executable
flhe
Updated on June 20, 2020Comments
-
flhe almost 4 years
When I do the following command:
root@starwars:/# export JAVA_OPTS="-Xms756m -Xmx756m -Xss128m -Xmn512m"
In which file will the values
"-Xms756m -Xmx756m -Xss128m -Xmn512m"
be written? -
flhe almost 13 yearsI wrote the following into /etc/init.d/tomcat6: if [ -z "$JAVA_OPTS" ]; then JAVA_OPTS="-Djava.awt.headless=true -Xms756m -Xmx756m -Xss128m -Xmn512m -XX:PermSize=512m -XX:MaxPermSize=512m -XX:NewRatio=3 -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -XX:+$ fi restarted, but doesn't take the values.
-
nos almost 13 yearsYou'd have to at least
export
that variable.