




已阅读5页,还剩2页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
一.配置环境变量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。二 配置Tomcat启动环境(注意,如果已经象前面那样设置过了,这里就可以跳过了)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 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 License, Version 2.0rem (the License); you may not use this file except in compliance with2.如果需要使用shutdown.bat关闭服务器的话,也按照上面加入两行。片段如下: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.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 withrem the License. You may obtain a copy of the License atrem3、这样,运行startup.bat就可以运行服务器,运行shutdown.bat就可以关闭服务器了。 但是这样运行startup.bat后不能把startup.bat弹出的窗口关掉,否则就退出了tomcat6.0服务,所以为了使用方便我们可以考虑把tomcat6.0加入系统的服务中去三 将Tomcat加入服务/说明:如果你已经按照第一步(即一.配置环境变量),且运行startup.bat和shutdown.bat能成功那么下面第一就不要做了,否则会出现错误1、修改bin目录中的service.bat:REM 添加下面的一行set CATALINA_HOME=%cd%如果从来没有安装过Tomcat,或者保证Services.msc启动服务管理器检查没有Apache Tomcat系统服务,到此你就可以转到第二步了。否则继续往下走/第一步一般不要了,否则可能出错!REM 按照描述修改下面的几行set SERVICE_NAME=Tomcat6REM 上面一行,Tomcat6修改成你需要的服务名,这个将是一后使用net start/stop来操作的服务名称。/注意这一步很重要,如果你的系统现在有安装tomcat6.0,那么你一定要把tomcat6改成其它名字,而且不要以tomcat6为前缀,否则会由于你系统已经存在服务tomcat6而启动失败,可以把名字改为:你的名字+Tomcat6形式set PR_DISPLAYNAME=Apache TomcatREM 上面一行,Apache Tomcat改为你需要的显示服务名,这个将显示在服务管理器中。/注意这一步也是很重要,如果你的系统现在有安装tomcat6.0,那么你一定要不Apache tomcat改成其它名字,而且不要以Apache tomcat为前缀,否则会由于你系统已经存在服务Apache tomcat而启动失败,可以把名字改为:你的名字+apache形式set PR_DESCRIPTION=Apache Tomcat Server - /tomcatREM 这一行改不改无所谓,是服务的描述,根据自己的喜好决定吧。我的tomcat6.0中bin下的service.bat(下载后没有经过其它的配置修改,保持下载时的状态)修改后如下:贴出来如下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 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 atremrem /licenses/LICENSE-2.0remrem Unless required by applicable law or agreed to in writing, softwarerem distributed under the License is 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 Optionsrem 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: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 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 definedecho This environment variable is needed to run this programgoto end :okHomeif not %CATALINA_BASE% = goto gotBaseset CATALINA_BASE=%CATALINA_HOME%:gotBase set 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 = goto setServiceNameset SERVICE_NAME=%2set PR_DISPLAYNAME=Apache Tomcat %2:setServiceNameif %1 = install goto doInstallif %1 = remove goto doRemoveif %1 = uninstall goto doRemoveecho Unknown parameter %1:displayUsageecho.echo Usage: service.bat install/remove service_namegoto end:doRemoverem Remove the service%EXECUTABLE% /DS/%SERVICE_NAME%echo The service %SERVICE_NAME% has been removedgoto end:doInstallrem Install the serviceecho Installing the service %SERVICE_NAME% .echo Using CATALINA_HOME: %CATALINA_HOME%echo Using CATALINA_BASE: %CATALINA_BASE%echo Using JAVA_HOME: %JAVA_HOME%rem Use the environment variables as an examplerem Each command line option is prefixed with PR_set PR_DESCRIPTION=Apache Tomcat Server - /set PR_INSTALL=%EXECUTABLE%set PR_LOGPATH=%CATALINA_BASE%logsset PR_CLASSPATH=%CATALINA_HOME%binbootstrap.jarrem Set the server jvm from JAVA_HOMEset PR_JVM=%JAVA_HOME%jrebinserverjvm.dllif exist %PR_JVM% goto foundJvmrem Set the client jvm from JAVA_HOMEset PR_JVM=%JAVA_HOME%jrebinclientjvm.dllif exist %PR_JVM% goto foundJvmset PR_JVM=auto:foundJvmecho Using JVM: %PR_JVM%EXECUTABLE% /IS/%SERVICE_NAME% -StartClass org.apache.catalina.startup.Bootstrap -StopClass org.apache.catalina.startup.Bootstrap -StartParams start -StopParams stopif not errorlevel 1 goto installedecho Failed installing %SERVICE_NAME% servicegoto end:installedrem Clear the environment variables. They are not needed any more.set PR_DISPLAYNAME=set PR_DESCRIPTION=set PR_INSTALL=set PR_LOGPATH=set PR_CLASSPATH=set PR_JVM=rem Set extra parameters%EXECUTABLE% /US/%SERVICE_NAME% -JvmOptions -Dcatalina.base=%CATALINA_BASE%;-Dcatalina.home=%CATALINA_HOME%;-Djava.endorsed.dirs=%CATALINA_HOME%endorsed -StartMode jvm -StopMode jvmrem More extra parametersset PR_LOGPATH=%CATALINA_BASE%logsset PR_STDOUTPUT=autoset PR_STDERROR=auto%EXECUTABLE% /US/%SERVICE_NAME% +JvmOptions -Djava.io.tmpdir=%CATALINA_BASE%temp;-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogM
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年注册验船师资格考试(B级船舶检验专业法律法规)测试题及答案五
- 幼儿园师德师风工作总结汇报5篇
- 2025年注册验船师考试(C级船舶检验专业基础安全)冲刺试题及答案一
- 2025年国际旅行社导游岗位面试题及标准答案公布
- 2025年房地产销售招聘面试技巧与模拟题集答案
- 四川省资阳市安岳县石羊中学2026届化学高一上期末调研试题含解析
- 2025年青少年心理健康辅导培训课程试题及答案
- 2025年食盐储备库管理知识模拟考试题库
- 2025年初级软件工程师考试模拟题及答题技巧指导
- 2025年街道安全员实操面试题库大全
- 统编版道德与法治四年级上册全册大单元整体教学设计
- 2025年全国大学生百科知识竞赛题库及答案(370题)
- 2025年乡村全科助理医师考试真题及答案
- 《翻转课堂的探索与应用》课件
- 小学2025-2026学年度第一学期工作计划
- 中学班主任培训课件
- 某体育公园可行性研究报告
- T-CCSAS 050-2024 化学化工实验室化学品安全操作规程编写指南
- 《生态学园林》课件
- 幼儿园教学主任培训
- 展会主办项目合同范例
评论
0/150
提交评论