tomcat/bin/service.bat
這個(gè)文件就是將tomcat安裝為系統(tǒng)服務(wù)的,參數(shù)為
Usage: service.bat install/remove [service_name]
install 為安裝服務(wù)
remove 為移除服務(wù)
可選的service_name是服務(wù)的名字,默認(rèn)為tomcat,這個(gè)參數(shù)是關(guān)鍵
下面是在另一個(gè)tomcatLZZ目錄下面做的配置,打開service.bat
rem Guess CATALINA_HOME if not defined
set CURRENT_DIR=%cd%
set CATALINA_HOME=d:\tomcatLZZ
if not "%CATALINA_HOME%" == "" goto gotHome
rem set CATALINA_HOME=%cd%
第三行是關(guān)鍵,直接在這里指定好了,別讓系統(tǒng)猜了。
運(yùn)行安裝
D:\tomcatLZZ\bin>service install tomcatLZZ
Installing the service 'tomcatLZZ' ...
Using CATALINA_HOME: d:\tomcatLZZ
Using CATALINA_BASE: d:\tomcatLZZ
Using JAVA_HOME: C:\Program Files\Java\jdk1.6.0_10
Using JVM: C:\Program Files\Java\jdk1.6.0_10\jre\bin\server\jvm.dll
The service 'tomcatLZZ' has been installed.
D:\tomcatLZZ\bin>
安裝成功了,系統(tǒng)有了2個(gè)tomcat的服務(wù)。使用各自的服務(wù)和配置。