1.修改service.bat文件(D:Tomcat8inservice.bat)该文件中共修改两处即可
在文件的开头加入以下设置,分别是java的安装路径、Tomcat的安装路径及服务的名称
SET JAVA_HOME=D:Program FilesJavajdk1.8.0_151
SET CATALINA_HOME=D:Tomcat8
SET PR_DISPLAYNAME=Tomcat8
在文件中部找到以下内容并修改
rem Set default Service name
set SERVICE_NAME=Tomcat8
修改为
rem Set default Service name
set SERVICE_NAME=Tomcat8
2.修改shutdown.bat和startup.bat文件,这两个文件修改的地方都相同在文件头加入以下内容
SET JAVA_HOME=D:Program FilesJavajdk1.8.0_151
SET CATALINA_HOME=D:TomcatServersTomcat8
3.在命令行窗口输入以下命令
service.bat install Tomcat8