环境:
OS:windows7_64bit
JDK:jdk1.6_64bit
tomcat:apache-tomcat-7.0.61-windows-x64
1、修改tomcat/bin/service.bat
set "CURRENT_DIR=%cd%"
set JAVA_HOME=D:\Java\jdk1.6.0_21
set CATALINA_HOME=F:\software\tomcat\tomcat1
if not "%CATALINA_HOME%" == "" goto gotHome
多个tomcat情况下,将此文件中所有tomcat7.exe重新命名(tomcat7_1),
..................................................................
rem Set default Service name
set SERVICE_NAME=exam_web1
set DISPLAYNAME=%SERVICE_NAME%
...................................................................
"%EXECUTABLE%" //IS//%SERVICE_NAME% ^
--Description "exam_web1" ^
--DisplayName "%DISPLAYNAME%" ^
--Install "%EXECUTABLE%" ^
--LogPath "%CATALINA_BASE%\logs" ^
--StdOutput auto ^
--StdError auto ^
--Classpath "%CLASSPATH%" ^
--Jvm "%JVM%" ^
--StartMode jvm ^
--StopMode jvm ^
--StartPath "%CATALINA_HOME%" ^
--StopPath "%CATALINA_HOME%" ^
--StartClass org.apache.catalina.startup.Bootstrap ^
--StopClass org.apache.catalina.startup.Bootstrap ^
--StartParams start ^
--StopParams stop ^
--Startup=auto ^
--JvmOptions "-Dcatalina.home=%CATALINA_HOME%;-Dcatalina.base=%CATALINA_BASE%;-Djava.endorsed.dirs=%CATALINA_HOME%\endorsed;-Djava.io.tmpdir=%CATALINA_BASE%\temp;-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager;-Djava.util.logging.config.file=%CATALINA_BASE%\conf\logging.properties;-XX:PermSize=128M;-XX:MaxPermSize=256M" ^
--JvmMs 1024 ^
--JvmMx 1024
2、执行service.bat install 服务名
F:\software\tomcat\tomcat1\bin>service.bat install EXAM_WEB1
Installing the service 'EXAM_WEB1' ...
Using CATALINA_HOME: "F:\software\tomcat\tomcat1"
Using CATALINA_BASE: "F:\software\tomcat\tomcat1"
Using JAVA_HOME: "D:\Java\jdk1.6.0_21"
Using JRE_HOME: "D:\Java\jdk1.6.0_21\jre"
Using JVM: "D:\Java\jdk1.6.0_21\jre\bin\server\jvm.dll"
The service 'EXAM_WEB1' has been installed.
3、打开系统服务可以找到注册的服务
4、访问tomcat主目录
5、启动tomcat管理端
F:\software\tomcat\tomcat1\bin>tomcat6w.exe //MS//EXAM_WEB1