Hi,
In this article, I will try to expose a Tomcat server installed like Windows service.
We will use Tomcat6, Windows7 and Jdk 6.
First, our Tomcat server is installed in the “C:\MyFiles\Development\Java\tools\TomCat” folder with the following executables:

– Tomcat6 is a service application for running Tomcat6 as NT service.
– Tomcat6w is a GUI application for monitoring and configuring Tomcat services.
Before to expose Tomcat server like Windows service, below the Tomcat server configuration in Eclipse:





First, we will start the cmd.exe like administrator:
So, we will expose the Tomcat server like Windows server with the below command (IS = Install Service):
01 | tomcat6 //IS//Tomcat6HUO --DisplayName="Apache Tomcat JAVABLOG.FR" --Install="C:\MyFiles\Development\Java\tools\TomCat\bin\tomcat6.exe" |
02 | --Description="This is my Tomcat server as windows service" |
03 | --Jvm="C:\Program Files\Java\jre6\bin\server\jvm.dll" |
05 | --StartClass=org.apache.catalina.startup.Bootstrap |
06 | --StartPath="C:\MyFiles\Development\Java\tools\TomCat" |
08 | --StopClass=org.apache.catalina.startup.Bootstrap |
09 | --StopPath="C:\MyFiles\Development\Java\tools\TomCat" |
10 | --Classpath="C:\Program Files\Java\jdk1.6.0_32\lib\tools.jar; |
11 | C:\MyFiles\Development\Java\tools\TomCat\lib\servlet-api.jar; |
12 | C:\MyFiles\Development\Java\tools\TomCat\bin\bootstrap.jar; |
13 | C:\MyFiles\Development\Java\tools\TomCat\bin\tomcat-juli.jar" |
14 | --StdOutput="C:\MyFiles\Development\Java\tools\TomCat\logs\catalina.out" |
15 | --StdError="C:\MyFiles\Development\Java\tools\TomCat\logs\stderr.log" |
Then, it is possible to update the Windows service configuration (US = Update Service):
1 | tomcat6 //US//Tomcat6HUO |
2 | ++JvmOptions="-Xrs;-Dcatalina.base=C:\MyFiles\Development\Java\tools\TomCat; |
3 | -Dcatalina.home=C:\MyFiles\Development\Java\tools\TomCat; |
4 | -Dwtp.deploy=C:\MyFiles\Development\Java\tools\TomCat\webapps; |
5 | -Djava.endorsed.dirs=C:\MyFiles\Development\Java\tools\TomCat\endorsed; |
6 | -Djava.security.auth.login.config=C:\MyFiles\Development\Java\tools\TomCat\conf\jaas.config; |
7 | -Dcom.sun.management.jmxremote.port=18080; |
8 | -Dcom.sun.management.jmxremote.authenticate=false" |
For information, it is possible to use environnement variables:
1 | C:\MyFiles\Development\Java\tools\TomCat\bin>echo %JAVA_HOME% |
2 | C:\Program Files\Java\jdk1.6.0_32 |
For example, we could use the JAVA_HOME variable:
1 | --Classpath=%JAVA_HOME%\lib\tools.jar; |
3 | --Classpath="C:\Program Files\Java\jdk1.6.0_32\lib\tools.jar;" |
Of course, a service could be delete with the command (DS = Delete Service):
1 | tomcat6 //DS//Tomcat6HUO |
The result should be :

The properties of Tomcat service are:

…and when we try to start the service, we obtain the following error:

==> I don’t found the solution of this problem, have you already encountered the same error?
For more information, read the page : http://tomcat.apache.org/tomcat-6.0-doc/windows-service-howto.html
Thanks in advance,
Huseyin OZVEREN
Related