Tomcat 7 Installation

Installing services

The safest way to manually install the service is to use the provided service.bat script. Administrator privileges are required to run this script. If necessary, you can use the /user switch to specify a user to use for the installation of the service.

NOTE: On Windows Vista or any other operating system with User Account Control (UAC) you must either disable UAC or right-click on cmd.exe and select "Run as administrator" in order to run this script. If UAC is enabled neither being logged on with an Administrator account, nor using the /user switch is sufficient.

Install the service named 'Tomcat7'
C:\> service.bat install

If using tomcat7.exe, you need to use the //IS// parameter.

Install the service named 'Tomcat7'
C:\> tomcat7 //IS//Tomcat7 --DisplayName="Apache Tomcat 7" \
C:\> --Install="C:\Program Files\Tomcat\bin\tomcat7.exe" --Jvm=auto \
C:\> --StartMode=jvm --StopMode=jvm \
C:\> --StartClass=org.apache.catalina.startup.Bootstrap --StartParams=start \
C:\> --StopClass=org.apache.catalina.startup.Bootstrap --StopParams=stop

Updating services

To update the service parameters, you need to use the //US// parameter.

Update the service named 'Tomcat7'
C:\> tomcat7 //US//Tomcat7 --Description="Apache Tomcat Server - http://tomcat.apache.org/ " \
C:\> --Startup=auto --Classpath=%JAVA_HOME%\lib\tools.jar;%CATALINA_HOME%\bin\bootstrap.jar

Removing services

To remove the service, you need to use the //DS// parameter.
If the service is running it will be stopped and then deleted.

Remove the service named 'Tomcat7'
C:\> tomcat7 //DS//Tomcat7

Debugging services

To run the service in console mode, you need to use the //TS// parameter. The service shutdown can be initiated by pressing CTRL+C or CTRL+BREAK. If you rename the tomcat7.exe to testservice.exe then you can just execute the testservice.exe and this command mode will be executed by default.

Run the service named 'Tomcat7' in console mode
C:\> tomcat7 //TS//Tomcat7 [additional arguments]
Or simply execute:
C:\> tomcat7

参考:http://tomcat.apache.org/tomcat-7.0-doc/windows-service-howto.html

posted @ 2011-10-09 14:18  无尽思绪  阅读(345)  评论(0编辑  收藏  举报