Configure Tomcat as a system service under windows

1. Download the decompressed version of Tomcat, unzip it to a directory you know, startup.bat shutdown.bat service.bat and other files are in the bin directory of tomcat

2. Modify the startup.bat file:

    Add the following statement before the first line:

    SET JAVA_HOME=% own JDK path% (example: C:\Program Files\Java\jdk1.7.0_04)

    SET CATALINA_HOME=% own Tomcat path% (example: C:\Program Files\Tomcat\apache-tomcat-7.0.57)

3. Modify the shutdown.bat file

 

    Add the following statement before the first line:

    SET JAVA_HOME=% own JDK path% (example: C:\Program Files\Java\jdk1.7.0_04)

    SET CATALINA_HOME=% own Tomcat path% (example: C:\Program Files\Tomcat\apache-tomcat-7.0.57)

4. Modify the service.bat file

    Add the following statement before the first line:

    SET CATALINA_HOME=% own Tomcat path% (example: C:\Program Files\Tomcat\apache-tomcat-7.0.57)

    SET SERVICE_NAME=tomcatServer (the name of the service, which is used to control the service (start/stop) on the command line)

    SET PR_DISPLAYNAME=tomcatServer (The display name of the service, that is, the name displayed in the service manager.)

5. Install Tomcat Service

    In the DOS command interface, enter the bin directory of Tomcat:

    cd C:\Program Files\Tomcat\apache-tomcat-7.0.57\bin

    Install the service named tomcatServer:

    service.bat install tomcatServer

    If the installation is successful, it will prompt: The service'tomcatServer' has been installed

6. Set tomcatServer service to start automatically

     Run the services.msc command, find the service named tomcatServer, and set the startup type to automatic

7. Uninstall Tomcat service

 

    In the DOS command interface, enter the bin directory of Tomcat:

    cd C:\Program Files\Tomcat\apache-tomcat-7.0.57\bin

    Execute: service.bat remove

Guess you like

Origin blog.csdn.net/adminBfl/article/details/103469994
Recommended