Reputation: 56944
I wouldn't ask this here unless I had exhausted the Tomcat reference guide and online searching had produced nadda.
Tomcat has a bin/catalina.sh
file where you can specify JVM options to start up with. For purposes outside the scope of this question, I'm wondering if Tomcat supports external configuration of these Java options outside catalina.sh
.
Thus, I'd be able to write some file, say, new-jvm-opts.xml
, and restart Tomcat, and have it use the options set up in this file (overriding any specified in catalina.sh
).
Upvotes: 1
Views: 1125
Reputation: 567
Use setenv.sh setenv.bat it's in the documentation - create a file called setenv.[sh/bat] depending on whether your running windows or unix. Add your vm args
set CATALINA_OPTS=-Xms512m -Xmx1024m
The setenv file is picked up on startup and applies your vm args, whilst avoiding editing your catalina.[sh/bat]
Upvotes: 1
Reputation: 11140
The catalina.sh script allows for Environment Variables to be already set on its startup. If you want to get JVM Opts in there, I think you just set them into whatever Environment your tomcat is starting in. Its documented in catalina.sh as "Environment Variable Prerequisites".
The ones I think you are interested in are either
# JAVA_OPTS (Optional) Java runtime options used when the "start",
# "stop", or "run" command is executed.
#
or
# CATALINA_OPTS (Optional) Java runtime options used when the "start",
# or "run" command is executed.
#
Upvotes: 2