Home Accessibility Courses Diary The Mouth Facebook Resources Site Map About Us Contact
CATALINA_OPTS v JAVA_OPTS - What is the difference?

There are two environment variables - CATALINA_OPTS and JAVA_OPTS - which are both used in the catalina.sh startup and shutdown script for Tomcat. They are described in comments within that file as:
(optional) Java runtime options used when the "start", "stop" or "run" command is executed [JAVA_OPTS]
and
(optional) Java runtime options used when the "start" or "run" command is executed [CATALINA_OPTS]

So why are there two different variables? And what's the 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.

The second difference is more subtle. Other applications may also use JAVA_OPTS, but only Tomcat will use CATALINA_OPTS. So if you're setting environment variables for use only by Tomcat, you'll be best advised to use CATALINA_OPTS, whereas if you're setting environment variables to be used by other java applications as well, such as by JBoss, you should put your settings in JAVA_OPTS.




"OK - so that's the difference. Give me some examples of what can go in there!"

You can increase heap memory available to the JVM - see here

You can open remote monitoring ports so that Jconsole on another system can watch how your Tomcat is running - see here

You can add in a -server to switch from the client (quicker start, slower running) JVM to the server (slower starting, quicker running) JVM.

You can increase java thread stack size using the -Xss option (same way to specify amount of memory as in -Xms and -Xmx as described in the "increase heap memory" link above.
(written 2009-05-09)

 
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
A654 - Web Application Deployment - Configuring and Controlling Tomcat
  [3043] Gathering information - logging - with log4j. First steps. - (2010-11-12)
  [2652] Reading and writing cookies in Java Servlets and JSPs - (2010-02-26)
  [2061] Tomcat 6 - Annotated Sample Configuration Files - (2009-03-01)
  [2039] The Invoker - (2009-02-13)
  [1994] tomcat-users.xml; what a difference a space made - (2009-01-16)
  [1943] Port and Glasses - (2008-12-14)
  [1762] WEB-INF (Tomcat) and .htaccess (httpd) - (2008-08-20)
  [1553] Automatic startup and shutdown of Tomcat - (2008-02-24)
  [1503] Web page (http) error status 405 - (2008-01-12)
  [1370] Apache Tomcat Performance Tuning - (2007-09-29)
  [1351] Compressing web pages sent out from server. Is it worth it? - (2007-09-14)
  [914] A practical example of roles - (2006-11-04)
  [907] Browser -> httpd -> Tomcat -> MySQL. Restarting. - (2006-10-28)
  [837] Tomcat - Shutdown port - (2006-08-18)


Back to
Admins thoughts on banning a member from a forum
Previous and next
or
Horse's mouth home
Forward to
Updating my public profile - Graham Ellis
Some other Articles
Watching the tele
Crossrefering documents with uniqueness and inconsistency issues - PHP proof of concept demo
Making Regular Expressions easy to read and maintain
Updating my public profile - Graham Ellis
CATALINA_OPTS v JAVA_OPTS - What is the difference?
Admins thoughts on banning a member from a forum
Get it right ... if it goes wrong, it takes so much effort to sort out!
PHP - getclass v instanceof
A long day to guess where
On the roof of a Melksham Spa House
4255 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86 at 50 posts per page


This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price.

Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2014: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 899360 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/mouth/2163_CAT ... ence-.html • PAGE BUILT: Sun Mar 30 15:20:58 2014 • BUILD SYSTEM: WomanWithCat