1.安装tomcat服务
进入tomcat的bin目录下,运行service.bat install安装
<code class="hljs r has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">E:\tomcat_8083\bin>service.bat install Installing the service <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'Tomcat7'</span> <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">...</span> Using CATALINA_HOME: <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"E:\tomcat_8083"</span> Using CATALINA_BASE: <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"E:\tomcat_8083"</span> Using JAVA_HOME: <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"E:\Program Files (x86)\jdk1.7.0_25_X64"</span> Using JRE_HOME: <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"E:\Program Files (x86)\jdk1.7.0_25_X64\jre"</span> Using JVM: <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"E:\Program Files (x86)\jdk1.7.0_25_X64\jre\bin\server\j vm.dll"</span> Failed installing <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'Tomcat7'</span> service</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li></ul>
如果提示Failed,可执行services.msc查看服务,看是否已存在Tomcat7服务,有则需要给新安装的服务指定其他名称,如下:
<code class="hljs r has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">E:\tomcat_8083\bin>service.bat install Tomcat_8083 Installing the service <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'Tomcat_8083'</span> <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">...</span> Using CATALINA_HOME: <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"E:\tomcat_8083"</span> Using CATALINA_BASE: <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"E:\tomcat_8083"</span> Using JAVA_HOME: <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"E:\Program Files (x86)\jdk1.7.0_25_X64"</span> Using JRE_HOME: <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"E:\Program Files (x86)\jdk1.7.0_25_X64\jre"</span> Using JVM: <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"E:\Program Files (x86)\jdk1.7.0_25_X64\jre\bin\server\j vm.dll"</span> The service <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'Tomcat_8083'</span> has been installed.</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li></ul>
提示安装成功!
如果需要删除服务,则使用
<code class="hljs tex has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">E:<span class="hljs-command" style="box-sizing: border-box; color: rgb(0, 0, 136);">\tomcat</span>_8085<span class="hljs-command" style="box-sizing: border-box; color: rgb(0, 0, 136);">\bin</span>>sc delete Tomcat7 <span class="hljs-special" style="box-sizing: border-box; color: rgb(102, 102, 0);">[</span>SC<span class="hljs-special" style="box-sizing: border-box; color: rgb(102, 102, 0);">]</span> DeleteService 成功</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul>
2.将服务设置成自启动
以上
注意:实测中,webapp文件夹中删除了root文件等,导致进入不了8080管理页面
ROOT处理网站根目录数据,删除不影响运行,但是根目录无法访问
MANAGER用于TOMCAT自身管理平台页,删掉以后管理器就不能用了,但是也不影响运行