Omar Kooheji Omar Kooheji - 1 month ago 7
Java Question

Passing JVM arguments to Tomcat when running as a service?

I need to pass a couple of JVM arguments to the JVM which Tomcat is running in so that my application can pick them up.

I want to follow the process outlined in this article to pick up environment variables.

How would I go about doing this?

UPDATE
Sorry This is running under windows (7 on my Dev machine 2003 on client server)

Answer

You need to edit the Windows service. There are three ways to do this:

  1. Start Tomcat5w with //MS//ServiceName to get an icon in the system tray which gives you a quick access to the configuration of the service.

  2. Open the service manager in the "Control Panel". There is an entry for Tomcat.

In the editor, there is a tab where you can add additional JVM parameters.

The third way (which I prefer) is to write a script which edits the config for you. This way, you can save the config somewhere for backup. See the docs how to do that (Hint: use tomcat5 //US//...)