CATALINA_OPTS and JAVA_OPTS are two major environment variables used in tomcat and other applications. Both are used in the catalina.sh startup and shutdown scripts for Tomcat. They are described in comments within that file as:
[JAVA_OPTS] (optional) Java runtime options used when the "start", "stop" or "run" command is executed
[CATALINA_OPTS] (optional) Java runtime options used when the "start" or "run" command is executed
Then why are there two different variables? What's the key difference?
Firstly, anything specified in EITHER variable is passed, identically, to the command that starts up Tomcat - the "start" or "run" command - but only values set in JAVA_OPTS are passed to the "stop" command. That probably doesn't make any difference to how Tomcat runs in practise as it only effects the end of a run, not the start.
Secondly, other applications may also use JAVA_OPTS, but only Tomcat will use CATALINA_OPTS. So if setting environment variables for use only by Tomcat, it's best to use CATALINA_OPTS, whereas if setting environment variables to be used by other java applications as well, such as by JBoss, it's better to put settings in JAVA_OPTS.
[JAVA_OPTS] (optional) Java runtime options used when the "start", "stop" or "run" command is executed
[CATALINA_OPTS] (optional) Java runtime options used when the "start" or "run" command is executed
Then why are there two different variables? What's the key difference?
Firstly, anything specified in EITHER variable is passed, identically, to the command that starts up Tomcat - the "start" or "run" command - but only values set in JAVA_OPTS are passed to the "stop" command. That probably doesn't make any difference to how Tomcat runs in practise as it only effects the end of a run, not the start.
Secondly, other applications may also use JAVA_OPTS, but only Tomcat will use CATALINA_OPTS. So if setting environment variables for use only by Tomcat, it's best to use CATALINA_OPTS, whereas if setting environment variables to be used by other java applications as well, such as by JBoss, it's better to put settings in JAVA_OPTS.
No comments :
Post a Comment