解压版tomcat创建服务启动

上传人:第*** 文档编号:31929648 上传时间:2018-02-09 格式:DOC 页数:7 大小:45KB
返回 下载 相关 举报
解压版tomcat创建服务启动_第1页
第1页 / 共7页
解压版tomcat创建服务启动_第2页
第2页 / 共7页
解压版tomcat创建服务启动_第3页
第3页 / 共7页
解压版tomcat创建服务启动_第4页
第4页 / 共7页
解压版tomcat创建服务启动_第5页
第5页 / 共7页
点击查看更多>>
资源描述

《解压版tomcat创建服务启动》由会员分享,可在线阅读,更多相关《解压版tomcat创建服务启动(7页珍藏版)》请在金锄头文库上搜索。

1、一.配置环境变量1.把 JDK安装到 C:Program FilesJavajdk1.6.0,下载免安装版 tomcat6.0(Tomcat Zip)压缩包 ,把 Tomcat解压放到 C:Tomcat6.0下2.添加系统环境变量:JAVA_HOME=C:Program FilesJavajdk1.6.0CLASSPATH=.;%JAVA_HOME%libTOMCAT_HOME=C:Tomcat6.0修改系统环境变量 PATH,在它的最前面加入:%JAVA_HOME%bin;注:放在最前面是预防有其它的 JDK或 JRE路径占先,如你装了 Oracle就会有一个低版本的 JRE。二 配置 To

2、mcat 启动环境(注意,如果已经象前面那样设置过了,这里就可以跳过了)1、修改 startup.bat 文件:在第一行前面加入如下两行SET JAVA_HOME=JDK 目录SET CATALINA_HOME=前面解压后 Tomcat 的目录片段如下:echo offSET JAVA_HOME=C:Program FilesJavajdk1.6.0SET CATALINA_HOME=C:Tomcat6.0rem Licensed to the Apache Software Foundation (ASF) under one or morerem contributor license a

3、greements. See the NOTICE file distributed withrem this work for additional information regarding copyright ownership.rem The ASF licenses this file to You under the Apache License, Version 2.0rem (the License); you may not use this file except in compliance with2.如果需要使用 shutdown.bat 关闭服务器的话,也按照上面加入

4、两行。片段如下:echo offSET JAVA_HOME=C:Program FilesJavajdk1.6.0SET CATALINA_HOME=C:Tomcat6.0rem Licensed to the Apache Software Foundation (ASF) under one or morerem contributor license agreements. See the NOTICE file distributed withrem this work for additional information regarding copyright ownership.r

5、em The ASF licenses this file to You under the Apache License, Version 2.0rem (the License); you may not use this file except in compliance withrem the License. You may obtain a copy of the License atrem3、这样,运行 startup.bat 就可以运行服务器,运行 shutdown.bat 就可以关闭服务器了。但是这样运行 startup.bat 后不能把 startup.bat 弹出的窗口关

6、掉,否则就退出了tomcat6.0 服务,所以为了使用方便我们可以考虑把 tomcat6.0 加入系统的服务中去三 将 Tomcat 加入服务/说明:如果你已经按照第一步(即一.配置环境变量),且运行 startup.bat和 shutdown.bat能成功那么下面第一就不要做了,否则会出现错误1、修改 bin 目录中的 service.bat:REM 添加下面的一行set CATALINA_HOME=%cd%如果从来没有安装过 Tomcat,或者保证 Services.msc 启动服务管理器检查没有Apache Tomcat 系统服务,到此你就可以转到第二步了。否则继续往下走/第一步一般不要

7、了,否则可能出错!REM 按照描述修改下面的几行set SERVICE_NAME=Tomcat6REM 上面一行,Tomcat6 修改成你需要的服务名,这个将是一后使用 net start/stop来操作的服务名称。/注意这一步很重要,如果你的系统现在有安装 tomcat6.0,那么你一定要把tomcat6改成其它名字,而且不要以tomcat6为前缀,否则会由于你系统已经存在服务tomcat6而启动失败,可以把名字改为:你的名字+Tomcat6 形式set PR_DISPLAYNAME=Apache TomcatREM 上面一行,Apache Tomcat 改为你需要的显示服务名,这个将显示在

8、服务管理器中。/注意这一步也是很重要,如果你的系统现在有安装 tomcat6.0,那么你一定要不Apache tomcat改成其它名字,而且不要以 Apache tomcat为前缀 ,否则会由于你系统已经存在服务Apache tomcat而启动失败, 可以把名字改为:你的名字 +apache 形式set PR_DESCRIPTION=Apache Tomcat Server - http:/jakarta.apache.org/tomcatREM 这一行改不改无所谓,是服务的描述,根据自己的喜好决定吧。我的 tomcat6.0中 bin下的 service.bat(下载后没有经过其它的配置修改

9、,保持下载时的状态)修改后如下:贴出来如下echo offrem Licensed to the Apache Software Foundation (ASF) under one or morerem contributor license agreements. See the NOTICE file distributed withrem this work for additional information regarding copyright ownership.rem The ASF licenses this file to You under the Apache Lic

10、ense, Version 2.0rem (the License); you may not use this file except in compliance withrem the License. You may obtain a copy of the License atremrem http:/www.apache.org/licenses/LICENSE-2.0remrem Unless required by applicable law or agreed to in writing, softwarerem distributed under the License i

11、s distributed on an AS IS BASIS,rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.rem See the License for the specific language governing permissions andrem limitations under the License.if %OS% = Windows_NT setlocalrem -rem NT Service Install/Uninstall scriptremrem Options

12、rem install Install the service using Tomcat6 as service name.rem Service is installed using default settings.rem remove Remove the service from the System.remrem name (optional) If the second argument is present it is consideredrem to be new service name remrem $Id: service.bat 600659 2007-12-03 20

13、:15:09Z jim $rem -rem Guess CATALINA_HOME if not definedset CURRENT_DIR=%cd%if not %CATALINA_HOME% = goto gotHomeset CATALINA_HOME=%cd%if exist %CATALINA_HOME%bintomcat6.exe goto okHomerem CD to the upper dircd .set CATALINA_HOME=%cd%:gotHomeif exist %CATALINA_HOME%bintomcat6.exe goto okHomeecho The

14、 tomcat.exe was not found.echo The CATALINA_HOME environment variable is not defined correctly.echo This environment variable is needed to run this programgoto endrem Make sure prerequisite environment variables are setif not %JAVA_HOME% = goto okHomeecho The JAVA_HOME environment variable is not de

15、finedecho This environment variable is needed to run this programgoto end :okHomeif not %CATALINA_BASE% = goto gotBaseset CATALINA_BASE=%CATALINA_HOME%:gotBaseset EXECUTABLE=%CATALINA_HOME%bintomcat6.exerem Set default Service nameset SERVICE_NAME=haotomcat6/原来为 set SERVICE_NAME=Tomcat6,这里 hao是我的名字set PR_DISPLAYNAME=hao apache/原来为 set PR_DISPLAYNAME=Apache Tomcatif %1 = goto displayUsageif %2 =

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 行业资料 > 工业设计

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号