1. Modify the service.bat file (D:\Tomcat8\bin\service.bat) This file can be modified in two places
Add the following settings at the beginning of the file, which are the installation path of java, the installation path of Tomcat and the name of the service
SET JAVA_HOME=D:\Program Files\Java\jdk1.8.0_151
SET CATALINA_HOME=D:\Tomcat8
SET PR_DISPLAYNAME=Tomcat8
Find the following content in the middle of the file and modify it
rem Set default Service name
set SERVICE_NAME=Tomcat8
change into
rem Set default Service name
set SERVICE_NAME=Tomcat8
2. Modify the shutdown.bat and startup.bat files. The modification of these two files is the same. Add the following content to the file header
SET JAVA_HOME=D:\Program Files\Java\jdk1.8.0_151
SET CATALINA_HOME=D:\TomcatServers\Tomcat8
3. Enter the following command in the command line window \
service.bat install Tomcat8