tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Set Java VM arguments programmatically in Tomcat
Date Fri, 01 Jul 2011 02:10:25 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Anand,

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,
etc.

> 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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk4NLJEACgkQ9CaO5/Lv0PDQkwCgpPUIvxzVxB72RHxgdFHUW1aO
LGoAnioYym9HOjaRA5tYH7CKfeKfg/Mk
=4skK
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message