tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: Set Java VM arguments programmatically in Tomcat
Date Fri, 01 Jul 2011 02:10:25 GMT
Hash: SHA1


On 6/30/2011 6:18 PM, Anand HS wrote:
> Basically I would like not to use any batch scripts ( in Windows ) to set
> CATALINA_OPTS, JAVA_OPTS etc.. , instead would like to do it through a
> custom Java program and then hook up.

You can do this, except that your Java program must launch /a second
JVM/ in order to set properties -- specifically ones such as heap sizes,

> To this effect, I was wondering if
> there is a way to extend Bootstrap class of Tomcat to achieve it.

No. By the time the Bootstrap code is called, the heap has been
configured and it's too late.

> That said, I'm not sure if it is a recommended way to do it even since I was
> trying to just explore if batch files are the only options for me to feed in
> environment variables to Tomcat and Java.

If you install Tomcat as a service, you can set those parameters in the
service definition (itself a small program that launches the JVM with
the proper parameters) and do anything you want.

But you'll never be able to do this in any practical way through Java code.

- -chris
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message