Registering Tomcat as a Windows service

Source: Internet
Author: User
Tags apache tomcat

Configuring Environment variables

Java_home=d:\java

Classpath=.; %java_home%\lib;

Path=%java_home%\bin;

Tip: The generic JRE is%JAVA_HOME%\JRE in the JDK directory by default. If the JRE is not in the JDK directory, you need to configure a jre_home to point to the specific JRE path.

Registering Windows Services

Note : Because Windows after XP has changed the permissions policy, registering Windows Services requires Administrator privileges, and you must open the CMD window with administrator privileges to register successfully.

For example, under the Win7 system, enter the directory c:/windows/system32/

    1. Execute command in CMD window: Service.bat Install

    1. Open the Service Management tool, you can see the services have been registered;

Service start and stop command line mode

Open the CMD window with Administrator privileges

The service name is: TOMCAT7

Start service: net start TOMCAT7

Stop service: net stop TOMCAT7

To start a service in the Service Management tool

Set to boot

Right-click the service, select Properties, change the service startup type to Automatic;

Start with the Tomcat service Configuration tool

Enter the Tomcat\bin directory to run with Administrator privileges Tomcat7w.exe

FAQ: Reason for service registration failure

1) If it is Win7, it is possible that the CMD window is not running as an administrator

2) It is also possible that the JDK version and Tomcat do not match, try to replace the JDK after the registration;

2. System error 109 Pipeline has ended

Command line mode Stop error

Stop service in service Management tool, error

On the internet for a long time, little information, adjusted to stop the service timeout, or not. Later in this article (http://blog.sina.com.cn/s/blog_824f62b3010112s3.html) inspired by the method to configure a return approach, unexpectedly no error. Here's how to modify it:

Timeout time better set a little longer, more than 20 seconds, or stop the service or may error. If set to 0, I guess there should be no time-out, that is, the maximum time-out, but the actual use of service management tools to stop the service, the progress bar will remain stuck, the command line will wait a long time, and then reported "service does not respond to control function", do not know why.

Appendix: Service.bat Configuration parameter description

Set SERVICE_NAME=TOMCAT7

Set Pr_displayname=apache Tomcat 7

Set Pr_description=apache Tomcat 7.0.5 server-http://tomcat.apache.org/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.