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/
- Execute command in CMD window: Service.bat Install
- 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/