问题:tomcat7解压版,通过startup.bat手动启动tomcat后会出现对话框,如果机器意外重启,tomcat还需要手动重启,比较麻烦。
解决:将tomcat安装成系统服务,设置启动方式为自启动。
1.安装tomcat服务
进入tomcat的bin目录下,运行service.bat install安装
E:\tomcat_8083\bin>service.bat install
Installing the service 'Tomcat7' ...
Using CATALINA_HOME: "E:\tomcat_8083"
Using CATALINA_BASE: "E:\tomcat_8083"
Using JAVA_HOME: "E:\Program Files (x86)\jdk1.7.0_25_X64"
Using JRE_HOME: "E:\Program Files (x86)\jdk1.7.0_25_X64\jre"
Using JVM: "E:\Program Files (x86)\jdk1.7.0_25_X64\jre\bin\server\j
vm.dll"
Failed installing 'Tomcat7' service
如果提示Failed,可执行services.msc查看服务,看是否已存在Tomcat7服务,有则需要给新安装的服务指定其他名称,如下:
E:\tomcat_8083\bin>service.bat install Tomcat_8083
Installing the service 'Tomcat_8083' ...
Using CATALINA_HOME: "E:\tomcat_8083"
Using CATALINA_BASE: "E:\tomcat_8083"
Using JAVA_HOME: "E:\Program Files (x86)\jdk1.7.0_25_X64"
Using JRE_HOME: "E:\Program Files (x86)\jdk1.7.0_25_X64\jre"
Using JVM: "E:\Program Files (x86)\jdk1.7.0_25_X64\jre\bin\server\j
vm.dll"
The service 'Tomcat_8083' has been installed.
提示安装成功!
如果需要删除服务,则使用
E:\tomcat_8085\bin>sc delete Tomcat7
[SC] DeleteService 成功
2.将服务设置成自启动
以上