For Web projects, a frequently used server is Tomcat. But the trouble is, every time you have to start the Tomcat service. However, if the Tomcat service is registered as a Windows Service service, it can be set to boot automatically so that it does not have to be started manually each time.
1. Software and Environment
Environment: JDK1.8 (ensure that the JDK environment variable is installed)
App Service: Tomcat7.0 (non-installation version)
Operating system: WINDOWS8
2. Set up Tomcat for system service
Win+r Open the Run window, enter CMD to open the DOS window, use the CD command to switch the location to the bin file under the Tomcat path, the machine is under the F drive.
Input F: Enter the F-drive, enter the command CD F:\apache-tomcat-5.5.26\bin, and go to the Bin folder. Enter the service command to view the Service.bat file usage instructions, enter Service.bat install service_name can be installed services, Service_Name is the name of the service, you can name, My name here is Tomcatservice.
As shown, the service is registered, and the next step is to modify how the service is started.
3, modify the starting mode
Win+r Open the Run window, enter the control command to open the dashboard, locate the administration tool, open the service, and you will see a newly registered service called Apache Tomcat 7.0 Tomcatservice. Right-click the property to change the startup type to Automatic.
3. Setting up Dependent services
Sometimes we need to start the database service before we start the Tomcat service. That is, the start-up database service starts after startup to automatically start the Tomcat service, which is the ability to set up Tomcat service and database service dependencies on.
Suppose the computer now has a registered database service, named Mysqlservice, now to set Tomcatservice and Mysqlservice dependent on the use of SC config Tomcatservice depend= Mysqlservice command to execute (note that there is a space between depend= and Mysqlservice). After you set it up, you can view it in the properties of the service--dependencies.
4. Delete Registered Services
Remove the registered service, similar to the Install command, using Remove. Open the DOS window and enter service remove Tomcatservice to delete the services.
If the programmer is to knock the code, then we should pursue not to knock the duplicate code. The same is true for other operations, if the code smell is not good, then the operation once too much repetition is certainly not good. In this way, it must be thought that the operation of machinery to like to do mechanical work of the computer to complete their duties, rookie on the growth.
"Reprint" How to register Tomcat to window service service