blob: fcff6dac8108ce7061116e64954ad8e17b1e2e09 [file] [log] [blame]
Hongqing Liufd5ee812014-05-10 16:32:51 +08001@echo off
2rem Licensed to the Apache Software Foundation (ASF) under one or more
3rem contributor license agreements. See the NOTICE file distributed with
4rem this work for additional information regarding copyright ownership.
5rem The ASF licenses this file to You under the Apache License, Version 2.0
6rem (the "License"); you may not use this file except in compliance with
7rem the License. You may obtain a copy of the License at
8rem
9rem http://www.apache.org/licenses/LICENSE-2.0
10rem
11rem Unless required by applicable law or agreed to in writing, software
12rem distributed under the License is distributed on an "AS IS" BASIS,
13rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14rem See the License for the specific language governing permissions and
15rem limitations under the License.
16
Hongqing Liufd5ee812014-05-10 16:32:51 +080017rem ---------------------------------------------------------------------------
18rem Wrapper script for command line tools
19rem
20rem Environment Variable Prerequisites
21rem
刘洪青6266f992017-05-15 21:21:03 +080022rem CATALINA_HOME May point at your Catalina "build" directory.
Hongqing Liufd5ee812014-05-10 16:32:51 +080023rem
刘洪青6266f992017-05-15 21:21:03 +080024rem TOOL_OPTS (Optional) Java runtime options.
Hongqing Liufd5ee812014-05-10 16:32:51 +080025rem
刘洪青6266f992017-05-15 21:21:03 +080026rem JAVA_HOME Must point at your Java Development Kit installation.
27rem Using JRE_HOME instead works as well.
Hongqing Liufd5ee812014-05-10 16:32:51 +080028rem
刘洪青6266f992017-05-15 21:21:03 +080029rem JRE_HOME Must point at your Java Runtime installation.
30rem Defaults to JAVA_HOME if empty. If JRE_HOME and JAVA_HOME
31rem are both set, JRE_HOME is used.
32rem
33rem JAVA_OPTS (Optional) Java runtime options.
34rem
35rem JAVA_ENDORSED_DIRS (Optional) Lists of of semi-colon separated directories
36rem containing some jars in order to allow replacement of APIs
37rem created outside of the JCP (i.e. DOM and SAX from W3C).
38rem It can also be used to update the XML parser implementation.
39rem Defaults to $CATALINA_HOME/endorsed.
Hongqing Liufd5ee812014-05-10 16:32:51 +080040rem ---------------------------------------------------------------------------
41
刘洪青6266f992017-05-15 21:21:03 +080042setlocal
43
Hongqing Liufd5ee812014-05-10 16:32:51 +080044rem Guess CATALINA_HOME if not defined
刘洪青6266f992017-05-15 21:21:03 +080045set "CURRENT_DIR=%cd%"
Hongqing Liufd5ee812014-05-10 16:32:51 +080046if not "%CATALINA_HOME%" == "" goto gotHome
刘洪青6266f992017-05-15 21:21:03 +080047set "CATALINA_HOME=%CURRENT_DIR%"
Hongqing Liufd5ee812014-05-10 16:32:51 +080048if exist "%CATALINA_HOME%\bin\tool-wrapper.bat" goto okHome
刘洪青6266f992017-05-15 21:21:03 +080049cd ..
50set "CATALINA_HOME=%cd%"
51cd "%CURRENT_DIR%"
Hongqing Liufd5ee812014-05-10 16:32:51 +080052:gotHome
53if exist "%CATALINA_HOME%\bin\tool-wrapper.bat" goto okHome
54echo The CATALINA_HOME environment variable is not defined correctly
55echo This environment variable is needed to run this program
56goto end
57:okHome
58
59rem Ensure that any user defined CLASSPATH variables are not used on startup,
60rem but allow them to be specified in setenv.bat, in rare case when it is needed.
61set CLASSPATH=
62
63rem Get standard environment variables
64if exist "%CATALINA_HOME%\bin\setenv.bat" call "%CATALINA_HOME%\bin\setenv.bat"
65
66rem Get standard Java environment variables
67if exist "%CATALINA_HOME%\bin\setclasspath.bat" goto okSetclasspath
68echo Cannot find "%CATALINA_HOME%\bin\setclasspath.bat"
69echo This file is needed to run this program
70goto end
71:okSetclasspath
刘洪青6266f992017-05-15 21:21:03 +080072call "%CATALINA_HOME%\bin\setclasspath.bat" %1
73if errorlevel 1 goto end
Hongqing Liufd5ee812014-05-10 16:32:51 +080074
75rem Add on extra jar files to CLASSPATH
76rem Note that there are no quotes as we do not want to introduce random
77rem quotes into the CLASSPATH
刘洪青6266f992017-05-15 21:21:03 +080078if "%CLASSPATH%" == "" goto emptyClasspath
79set "CLASSPATH=%CLASSPATH%;"
80:emptyClasspath
81set "CLASSPATH=%CLASSPATH%%CATALINA_HOME%\bin\bootstrap.jar;%CATALINA_HOME%\bin\tomcat-juli.jar;%CATALINA_HOME%\lib\servlet-api.jar"
82
83set JAVA_OPTS=%JAVA_OPTS% -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
Hongqing Liufd5ee812014-05-10 16:32:51 +080084
85rem Get remaining unshifted command line arguments and save them in the
86set CMD_LINE_ARGS=
87:setArgs
88if ""%1""=="""" goto doneSetArgs
89set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
90shift
91goto setArgs
92:doneSetArgs
93
94%_RUNJAVA% %JAVA_OPTS% %TOOL_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.home="%CATALINA_HOME%" org.apache.catalina.startup.Tool %CMD_LINE_ARGS%
95
96:end