1@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 17rem --------------------------------------------------------------------------- 18rem Wrapper script for command line tools 19rem 20rem Environment Variable Prerequisites 21rem 22rem CATALINA_HOME May point at your Catalina "build" directory. 23rem 24rem TOOL_OPTS (Optional) Java runtime options. 25rem 26rem JAVA_HOME Must point at your Java Development Kit installation. 27rem Using JRE_HOME instead works as well. 28rem 29rem 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 This is only supported for Java <= 8. 40rem Defaults to $CATALINA_HOME/endorsed. 41rem --------------------------------------------------------------------------- 42 43setlocal 44 45rem Guess CATALINA_HOME if not defined 46set "CURRENT_DIR=%cd%" 47if not "%CATALINA_HOME%" == "" goto gotHome 48set "CATALINA_HOME=%CURRENT_DIR%" 49if exist "%CATALINA_HOME%\bin\tool-wrapper.bat" goto okHome 50cd .. 51set "CATALINA_HOME=%cd%" 52cd "%CURRENT_DIR%" 53:gotHome 54if exist "%CATALINA_HOME%\bin\tool-wrapper.bat" goto okHome 55echo The CATALINA_HOME environment variable is not defined correctly 56echo This environment variable is needed to run this program 57goto end 58:okHome 59 60rem Ensure that any user defined CLASSPATH variables are not used on startup, 61rem but allow them to be specified in setenv.bat, in rare case when it is needed. 62set CLASSPATH= 63 64rem Get standard environment variables 65if exist "%CATALINA_HOME%\bin\setenv.bat" call "%CATALINA_HOME%\bin\setenv.bat" 66 67rem Get standard Java environment variables 68if exist "%CATALINA_HOME%\bin\setclasspath.bat" goto okSetclasspath 69echo Cannot find "%CATALINA_HOME%\bin\setclasspath.bat" 70echo This file is needed to run this program 71goto end 72:okSetclasspath 73call "%CATALINA_HOME%\bin\setclasspath.bat" %1 74if errorlevel 1 goto end 75 76rem Add on extra jar files to CLASSPATH 77rem Note that there are no quotes as we do not want to introduce random 78rem quotes into the CLASSPATH 79if "%CLASSPATH%" == "" goto emptyClasspath 80set "CLASSPATH=%CLASSPATH%;" 81:emptyClasspath 82set "CLASSPATH=%CLASSPATH%%CATALINA_HOME%\bin\bootstrap.jar;%CATALINA_HOME%\bin\tomcat-juli.jar;%CATALINA_HOME%\lib\servlet-api.jar;%CATALINA_HOME%\lib\tomcat-util.jar" 83 84set JAVA_OPTS=%JAVA_OPTS% -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager 85 86rem Java 9 no longer supports the java.endorsed.dirs 87rem system property. Only try to use it if 88rem JAVA_ENDORSED_DIRS was explicitly set 89rem or CATALINA_HOME/endorsed exists. 90set ENDORSED_PROP=ignore.endorsed.dirs 91if "%JAVA_ENDORSED_DIRS%" == "" goto noEndorsedVar 92set ENDORSED_PROP=java.endorsed.dirs 93goto doneEndorsed 94:noEndorsedVar 95if not exist "%CATALINA_HOME%\endorsed" goto doneEndorsed 96set ENDORSED_PROP=java.endorsed.dirs 97:doneEndorsed 98 99rem Get remaining unshifted command line arguments and save them in the 100set CMD_LINE_ARGS= 101:setArgs 102if ""%1""=="""" goto doneSetArgs 103set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1 104shift 105goto setArgs 106:doneSetArgs 107 108%_RUNJAVA% %JAVA_OPTS% %TOOL_OPTS% -D%ENDORSED_PROP%="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.home="%CATALINA_HOME%" org.apache.catalina.startup.Tool %CMD_LINE_ARGS% 109 110:end 111