Installing Tomcat as a service
I needed to reinstall Tomcat as a service this morning. I found this reference which I’d used before in the past but has now disappeared. Luckily Google cached it.This originally appeared on mattkelli.com.
Setting up TomCat 4.1.12 to run as an NT Service:
* Set NT environment variables:
CATALINA_HOME=C:/jakarta-tomcat-4.1.12 CATALINA_OPTS=-server -Xms128m -Xmx512m
* Open up a new command prompt (ensures environment variables you just added are active)
* Run the following (must be all one line so you may have to put in notepad and then copy — copy from this page should work OK):
%CATALINA_HOME%/bin/tomcat.exe -install Tomcat %JAVA_HOME%/jre/bin/server/jvm.dll -Djava.class.path=%CATALINA_HOME%/bin/bootstrap.jar;%JAVA_HOME%/lib/tools.jar -Dcatalina.home=%CATALINA_HOME%
%CATALINA_OPTS% -Xrs -start org.apache.catalina.startup.BootstrapService -params start -stop org.apache.catalina.startup.BootstrapService -params stop -out %CATALINA_HOME%/logs/stdout.log -err
%CATALINA_HOME%/logs/stderr.log
To Uninstall Tomcat Service use:
%CATALINA_HOME%/bin/tomcat.exe -uninstall Tomcat
* You should get a message saying that the task was installed successfully.
* The service is called Tomcat

September 10th, 2004 at 4:14 pm
Should use org.apache.catalina.startup.Bootstrap instead of org.apache.catalina.startup.BootstrapService otherwise the “swallowOutput” context directive will not work (cfr. http://forum.java.sun.com/thread.jsp?thread=334663&forum=33&message=1367833 or other places for more information).