Tomcat Service Installation process.
When running tomcat as a service you may want to change or add initial parameters for the jvm.
This can be achived by using the tomcat.exe executable. I've noticed that this utility does not get extracted
if you are using automated installation of tomcat (by downloading the .exe distribution), and you do not check
the "run as a service" option at installation time.
To open command prompt :
[start] -> run -> cmd [enter]
Change directory (by using the command "cd") to get into the tomcat installation directory (refred here as $tomcat_home).
Then go into C:\$tomcat_home\bin\
If you already have installed service you should remove it before trying to install it again.
Note: these commands will not work unless :
The following command would uninstall a service identified by the name Apache Tomcat.
c:\$tomcat_home\bin\>tomcat.exe -uninstall "Apache Tomcat"
The following command will install a new service for tomcat with default settings (all on the same line).
c:\$tomcat_home\bin\>tomcat -install "Apache Tomcat"
"C:\Program Files\Java\j2re1.4.0\bin\client\jvm.dll"
-Djava.class.path="C:\$tomcat_home\bin\bootstrap.jar"
-Djava.endorsed.dirs="$tomcat_home\bin;$tomcat_home\common\lib"
-Dcatalina.home="C:\$tomcat_home"
-start org.apache.catalina.startup.BootstrapService -params start
-stop org.apache.catalina.startup.BootstrapService -params stop
-out "C:\$tomcat_home\logs\stdout.log"
-err "C:\$tomcat_home\logs\stderr.log"
The following command will install a new service for tomcat with new memory settings settings, here -Xmx256m allows this java-process to take up to 256 megabytes max ram, and start up with 128mb (all on the same line).
c:\$tomcat_home\bin\>tomcat -install "Apache Tomcat"
"C:\Program Files\Java\j2re1.4.0\bin\client\jvm.dll" -Xmx256m -Xms128m
-Djava.class.path="C:\$tomcat_home\bin\bootstrap.jar"
-Dcatalina.home="C:\$tomcat_home"
-start org.apache.catalina.startup.BootstrapService -params start
-stop org.apache.catalina.startup.BootstrapService -params stop
-out "C:\$tomcat_home\logs\stdout.log"
-err "C:\$tomcat_home\logs\stderr.log"
You can install the service using what ever extra/other value you want, and other parameters than identified in the line above.
You can find more information on performance related startup parameters at
http://java.sun.com/.
