Tomcat7.0.85 启动文件 startup.bat 和catalina.bat

startup.bat

@echo off
rem Licensed to the Apache Software Foundation (ASF) under one or more
rem contributor license agreements.  See the NOTICE file distributed with
rem this work for additional information regarding copyright ownership.
rem The ASF licenses this file to You under the Apache License, Version 2.0
rem (the "License"); you may not use this file except in compliance with
rem the License.  You may obtain a copy of the License at
rem
rem     http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing, software
rem 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 and
rem limitations under the License.

rem ---------------------------------------------------------------------------
rem Start script for the CATALINA Server
rem ---------------------------------------------------------------------------

setlocal  rem 该命令表示该批处理文件中修改的环境变量只在本文件中起作用,或者直到endLocal命令出现,被修改的环境变量才恢复原状。

rem Guess CATALINA_HOME if not defined  环境变量中是否配置
set "CURRENT_DIR=%cd%"                                  rem 将当前目录路径 赋值给CURRENT_DIR  即 xxx/tomcat7/bin
if not "%CATALINA_HOME%" == "" goto gotHome             rem 如果环境变量中的CATALINA_HOME 不为空 直接转到gotHome
set "CATALINA_HOME=%CURRENT_DIR%"                       rem 否则 设置CATALINA_HOME 为 当前目录(带有/bin 路径)
if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome rem 如果存在 %CATALINA_HOME%\bin\catalina.bat  就 转到okHome 显然这里不会转到,应为 有两个bin 了
cd ..                     rem 返回上级目录                                         
set "CATALINA_HOME=%cd%"  rem 将 CATALINA_HOME 设置 为 当前目录路径  即:xx/tomcat7/
cd "%CURRENT_DIR%"        rem  进入到 CURRENT_DIR  也就是 xxx/tomcat7/bin目录
:gotHome
if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome    rem  显然是 存在的 ,直接去 okHome
echo The CATALINA_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
goto end
:okHome

set "EXECUTABLE=%CATALINA_HOME%\bin\catalina.bat"  rem 设置 变量 EXECUTABLE= %CATALINA_HOME%\bin\catalina.bat  即:xx/tomcat7/bin/catalina.bat

rem Check that target executable exists  检查 bin\catalina.bat 文件是否存在
if exist "%EXECUTABLE%" goto okExec      rem 如果存在 转到okExec ,这里直接去okExec 
echo Cannot find "%EXECUTABLE%"
echo This file is needed to run this program
goto end
:okExec

rem Get remaining unshifted command line arguments and save them in the
set CMD_LINE_ARGS=                rem set CMD_LINE_ARGS=  表示清空CMD_LINE_ARGS
:setArgs
if ""%1""=="""" goto doneSetArgs  rem 判断是否有参数,这里 执行的 是 startup.bat  后面没有带任何的参数 ,所以""%1"""" 转到 doneSetArgs
set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1 
shift                             rem 该命令用来将参数后移一位即将%2%赋值给%1%,%3%赋值给%2%,也可以理解为参数列表左移即删除现有参数列表的第一位。
goto setArgs
:doneSetArgs

call "%EXECUTABLE%" start %CMD_LINE_ARGS%      rem call命令用来调用另外一条命令, 这里 调用的是 \bin\catalina.bat 然后第一个参数为start ,第二个为%CMD_LINE_ARGS%  即第二个为""

:end


复制代码

catalina.bat

@echo off
rem Licensed to the Apache Software Foundation (ASF) under one or more
rem contributor license agreements.  See the NOTICE file distributed with
rem this work for additional information regarding copyright ownership.
rem The ASF licenses this file to You under the Apache License, Version 2.0
rem (the "License"); you may not use this file except in compliance with
rem the License.  You may obtain a copy of the License at
rem
rem     http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing, software
rem 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 and
rem limitations under the License.

rem ---------------------------------------------------------------------------
rem Start/Stop Script for the CATALINA Server
rem
rem Environment Variable Prerequisites
rem
rem   Do not set the variables in this script. Instead put them into a script
rem   setenv.bat in CATALINA_BASE/bin to keep your customizations separate.
rem
rem   WHEN RUNNING TOMCAT AS A WINDOWS SERVICE:
rem   Note that the environment variables that affect the behavior of this
rem   script will have no effect at all on Windows Services. As such, any
rem   local customizations made in a CATALINA_BASE/bin/setenv.bat script
rem   will also have no effect on Tomcat when launched as a Windows Service.
rem   The configuration that controls Windows Services is stored in the Windows
rem   Registry, and is most conveniently maintained using the "tomcatXw.exe"
rem   maintenance utility, where "X" is the major version of Tomcat you are
rem   running.
rem
rem   CATALINA_HOME   May point at your Catalina "build" directory.
rem
rem   CATALINA_BASE   (Optional) Base directory for resolving dynamic portions
rem                   of a Catalina installation.  If not present, resolves to
rem                   the same directory that CATALINA_HOME points to.
rem
rem   CATALINA_OPTS   (Optional) Java runtime options used when the "start",
rem                   "run" or "debug" command is executed.
rem                   Include here and not in JAVA_OPTS all options, that should
rem                   only be used by Tomcat itself, not by the stop process,
rem                   the version command etc.
rem                   Examples are heap size, GC logging, JMX ports etc.
rem
rem   CATALINA_TMPDIR (Optional) Directory path location of temporary directory
rem                   the JVM should use (java.io.tmpdir).  Defaults to
rem                   %CATALINA_BASE%\temp.
rem
rem   JAVA_HOME       Must point at your Java Development Kit installation.
rem                   Required to run the with the "debug" argument.
rem
rem   JRE_HOME        Must point at your Java Runtime installation.
rem                   Defaults to JAVA_HOME if empty. If JRE_HOME and JAVA_HOME
rem                   are both set, JRE_HOME is used.
rem
rem   JAVA_OPTS       (Optional) Java runtime options used when any command
rem                   is executed.
rem                   Include here and not in CATALINA_OPTS all options, that
rem                   should be used by Tomcat and also by the stop process,
rem                   the version command etc.
rem                   Most options should go into CATALINA_OPTS.
rem
rem   JAVA_ENDORSED_DIRS (Optional) Lists of of semi-colon separated directories
rem                   containing some jars in order to allow replacement of APIs
rem                   created outside of the JCP (i.e. DOM and SAX from W3C).
rem                   It can also be used to update the XML parser implementation.
rem                   Note that Java 9 no longer supports this feature.
rem                   Defaults to $CATALINA_HOME/endorsed.
rem
rem   JPDA_TRANSPORT  (Optional) JPDA transport used when the "jpda start"
rem                   command is executed. The default is "dt_socket".
rem
rem   JPDA_ADDRESS    (Optional) Java runtime options used when the "jpda start"
rem                   command is executed. The default is 8000.
rem
rem   JPDA_SUSPEND    (Optional) Java runtime options used when the "jpda start"
rem                   command is executed. Specifies whether JVM should suspend
rem                   execution immediately after startup. Default is "n".
rem
rem   JPDA_OPTS       (Optional) Java runtime options used when the "jpda start"
rem                   command is executed. If used, JPDA_TRANSPORT, JPDA_ADDRESS,
rem                   and JPDA_SUSPEND are ignored. Thus, all required jpda
rem                   options MUST be specified. The default is:
rem
rem                   -agentlib:jdwp=transport=%JPDA_TRANSPORT%,
rem                       address=%JPDA_ADDRESS%,server=y,suspend=%JPDA_SUSPEND%
rem
rem   JSSE_OPTS       (Optional) Java runtime options used to control the TLS
rem                   implementation when JSSE is used. Default is:
rem                   "-Djdk.tls.ephemeralDHKeySize=2048"
rem
rem   LOGGING_CONFIG  (Optional) Override Tomcat's logging config file
rem                   Example (all one line)
rem                   set LOGGING_CONFIG="-Djava.util.logging.config.file=%CATALINA_BASE%\conf\logging.properties"
rem
rem   LOGGING_MANAGER (Optional) Override Tomcat's logging manager
rem                   Example (all one line)
rem                   set LOGGING_MANAGER="-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager"
rem
rem   TITLE           (Optional) Specify the title of Tomcat window. The default
rem                   TITLE is Tomcat if it's not specified.
rem                   Example (all one line)
rem                   set TITLE=Tomcat.Cluster#1.Server#1 [%DATE% %TIME%]
rem ---------------------------------------------------------------------------

setlocal    rem 该命令表示该批处理文件中修改的环境变量只在本文件中起作用,或者直到endLocal命令出现,被修改的环境变量才恢复原状。

rem Suppress Terminate batch job on CTRL+C   ctrl+c 禁止终止该批处理作业(禁止使用 CTRL+C 来终止批处理任务)
if not ""%1"" == ""run"" goto mainEntry         rem 如果第一个参数 不是"run" 就转到mainEntry  启动的时候传递的参数是  start ,所以启动的时候 直接到mainEntry
if "%TEMP%" == "" goto mainEntry                rem 如果环境变量中 TEMP 为 ""  就转到mainEntry    
if exist "%TEMP%\%~nx0.run" goto mainEntry      rem  %TEMP% 指向了环境变量的临时文件目录 ,%~nx0指向了本身运行的命令(文件名,这里即 catalina.bat) 整体也就是  \%TEMP%\catalina.bat.run
echo Y>"%TEMP%\%~nx0.run"                       rem 注: 可以新建一个文件(比如 a.bat) 文件中写  @echo off                
												rem												  echo  %TEMP%    
												rem												  echo  %~nx0.run  
												rem												  pause                       4行,然后双击运行可以看到 第二行是 a.bat.run 也就是说%~nx0指向了本身运行的命令



if not exist "%TEMP%\%~nx0.run" goto mainEntry     
echo Y>"%TEMP%\%~nx0.Y"
call "%~f0" %* <"%TEMP%\%~nx0.Y"
rem Use provided errorlevel
set RETVAL=%ERRORLEVEL%
del /Q "%TEMP%\%~nx0.Y" >NUL 2>&1
exit /B %RETVAL%
:mainEntry
del /Q "%TEMP%\%~nx0.run" >NUL 2>&1              rem  /Q 安静模式。删除全局通配符时,不要求确认;>NULL 表示前面命令执行抛出的异常将不显示;   1是标准输出;2是错误输出
                                                 rem  >> 是输出重定向符号;标准输出默认是打印到控制台,如果要导入到文件,就需要使用>或>>。> 会覆盖已有的文件内容,而>>会附加到已有内容之后。
												 rem  < 和 << 是输入重定向符号。从文件中读取内容。
                                                 rem  2>&1 是把错误输出导入(合并)到标准输出流中
                                                 rem  mainEntry这个标签的作用就是,删除临时目录下的catalina.bat.run文件,如果出错也不提示。												 

rem Guess CATALINA_HOME if not defined           rem 和startup.bat中的差不多,设置变量    
set "CURRENT_DIR=%cd%"
if not "%CATALINA_HOME%" == "" goto gotHome
set "CATALINA_HOME=%CURRENT_DIR%"
if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
cd ..
set "CATALINA_HOME=%cd%"
cd "%CURRENT_DIR%"
:gotHome

if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
echo The CATALINA_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
goto end
:okHome

rem Copy CATALINA_BASE from CATALINA_HOME if not defined
if not "%CATALINA_BASE%" == "" goto gotBase     
set "CATALINA_BASE=%CATALINA_HOME%"              rem 如果 CATALINA_BASE 为空 就把CATALINA_HOME 复制给它,也就是tomcat的根路径
:gotBase

rem Ensure that any user defined CLASSPATH variables are not used on startup,     确保任何用户定义的CALSSPATH变量 在启动的时候都不能使用(清空CALSSPATH)    
rem but allow them to be specified in setenv.bat, in rare case when it is needed.   在被指定到 setenv.bat 这种少见的情况下 是必要的
set CLASSPATH=                                   

rem Get standard environment variables   
if not exist "%CATALINA_BASE%\bin\setenv.bat" goto checkSetenvHome    rem 如果bin 下有setenv.bat 就转到checkSetenvHome,当前使用的是tomcat7.0.85  没有setenv.bat 文件
call "%CATALINA_BASE%\bin\setenv.bat"    
goto setenvDone
:checkSetenvHome
if exist "%CATALINA_HOME%\bin\setenv.bat" call "%CATALINA_HOME%\bin\setenv.bat"  rem 如果存在setenv.bat 就执行它 ,显然这里不存在
:setenvDone

rem Get standard Java environment variables
if exist "%CATALINA_HOME%\bin\setclasspath.bat" goto okSetclasspath    rem 如果bin下面有  setclasspath.bat 文件 就转到  okSetclasspath  显然 存在        
echo Cannot find "%CATALINA_HOME%\bin\setclasspath.bat"
echo This file is needed to run this program
goto end
:okSetclasspath
call "%CATALINA_HOME%\bin\setclasspath.bat" %1  rem 直接调用setclasspath.bat 传了第一个参数 ,即 start 参数(在startup.bat 调用 catalina.bat时传递的参数start)
if errorlevel 1 goto end                        rem  可以去看下 setclasspath.bat  主要设置了JAVA_HOME 和 JRE_HOME

rem Add on extra jar file to CLASSPATH
rem Note that there are no quotes as we do not want to introduce random
rem quotes into the CLASSPATH
if "%CLASSPATH%" == "" goto emptyClasspath                    rem 如果%CLASSPATH% 为空 转到emptyClasspath  ,上面清空了,所以直接到emptyClasspath
set "CLASSPATH=%CLASSPATH%;"
:emptyClasspath
set "CLASSPATH=%CLASSPATH%%CATALINA_HOME%\bin\bootstrap.jar"  rem 设置CLASPATH 为%CLASSPATH%%CATALINA_HOME%\bin\bootstrap.jar  也就是 tomcat/bin/bootstrap.jar

if not "%CATALINA_TMPDIR%" == "" goto gotTmpdir               rem %CATALINA_TMPDIR% 不为空就转到 gotTmpdir,否则设置为%CATALINA_BASE%\temp"  也就是 tomcat/temp 目录
set "CATALINA_TMPDIR=%CATALINA_BASE%\temp"
:gotTmpdir

rem Add tomcat-juli.jar to classpath
rem tomcat-juli.jar can be over-ridden per instance
if not exist "%CATALINA_BASE%\bin\tomcat-juli.jar" goto juliClasspathHome  rem 将tomcat-juli.jar 添加到 classpath  tomcat7/bin下面有tomcat-juli.jar  直接设置,然后 转到 juliClasspathDone
set "CLASSPATH=%CLASSPATH%;%CATALINA_BASE%\bin\tomcat-juli.jar"            
goto juliClasspathDone
:juliClasspathHome
set "CLASSPATH=%CLASSPATH%;%CATALINA_HOME%\bin\tomcat-juli.jar"
:juliClasspathDone

if not "%JSSE_OPTS%" == "" goto gotJsseOpts         rem 这里JSSE_OPTS 为"" 所以设置 JSSE_OPTS="-Djdk.tls.ephemeralDHKeySize=2048"
set JSSE_OPTS="-Djdk.tls.ephemeralDHKeySize=2048"   
:gotJsseOpts
set "JAVA_OPTS=%JAVA_OPTS% %JSSE_OPTS%"

if not "%LOGGING_CONFIG%" == "" goto noJuliConfig   rem 如果LOGGING_CONFIG 不为"" 就转到noJuliConfig ,这里是为""
set LOGGING_CONFIG=-Dnop                            rem 这里设置LOGGING_CONFIG=-Dnop 
if not exist "%CATALINA_BASE%\conf\logging.properties" goto noJuliConfig  rem 如果tomcat/conf/logging.roperties 不存在 转到noJuliConfig  ,这里 存在 所以直接 
set LOGGING_CONFIG=-Djava.util.logging.config.file="%CATALINA_BASE%\conf\logging.properties"               rem 这里 存在 所以直接 设置 LOGGING_CONFIG
:noJuliConfig

if not "%LOGGING_MANAGER%" == "" goto noJuliManager    rem 如果不存在 LOGGING_MANAGER 转到noJuliManager 这里是不存在的
set LOGGING_MANAGER=-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager rem 设置 LOGGING_MANAGER
:noJuliManager

rem Java 9 no longer supports the java.endorsed.dirs   Java9 不再支持 java.endorsed.dirs 
rem system property. Only try to use it if
rem JAVA_ENDORSED_DIRS was explicitly set
rem or CATALINA_HOME/endorsed exists.
set ENDORSED_PROP=ignore.endorsed.dirs
if "%JAVA_ENDORSED_DIRS%" == "" goto noEndorsedVar
set ENDORSED_PROP=java.endorsed.dirs
goto doneEndorsed
:noEndorsedVar
if not exist "%CATALINA_HOME%\endorsed" goto doneEndorsed
set ENDORSED_PROP=java.endorsed.dirs
:doneEndorsed

rem Configure JAVA 9 specific start-up parameters  配置Java 9 启动的参数
set "JDK_JAVA_OPTIONS=%JDK_JAVA_OPTIONS% --add-opens=java.base/java.lang=ALL-UNNAMED"
set "JDK_JAVA_OPTIONS=%JDK_JAVA_OPTIONS% --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED"

rem ----- Execute The Requested Command ---------------------------------------

echo Using CATALINA_BASE:   "%CATALINA_BASE%"    rem 打印相关信息
echo Using CATALINA_HOME:   "%CATALINA_HOME%"
echo Using CATALINA_TMPDIR: "%CATALINA_TMPDIR%"
if ""%1"" == ""debug"" goto use_jdk              rem 如果第一个参数为debug 就转到use_jdk
echo Using JRE_HOME:        "%JRE_HOME%"
goto java_dir_displayed
:use_jdk
echo Using JAVA_HOME:       "%JAVA_HOME%"
:java_dir_displayed
echo Using CLASSPATH:       "%CLASSPATH%"

set _EXECJAVA=%_RUNJAVA%                              rem 设置_EXECJAVA 为 %_RUNJAVA%(在setclasspath.bat中设置为了 %JRE_HOME%\bin\java.exe)
set MAINCLASS=org.apache.catalina.startup.Bootstrap   rem 设置MAINCLASS,ACTION;清空SECURITY_POLICY_FILE,DEBUG_OPTS,DEBUG_OPTS,JPDA
set ACTION=start
set SECURITY_POLICY_FILE=
set DEBUG_OPTS=
set JPDA=

if not ""%1"" == ""jpda"" goto noJpda          rem 如果第一个参数 不是 jpda 则转到noJpda ,这里为start 所以直接转到noJpda
set JPDA=jpda
if not "%JPDA_TRANSPORT%" == "" goto gotJpdaTransport
set JPDA_TRANSPORT=dt_socket
:gotJpdaTransport
if not "%JPDA_ADDRESS%" == "" goto gotJpdaAddress
set JPDA_ADDRESS=8000
:gotJpdaAddress
if not "%JPDA_SUSPEND%" == "" goto gotJpdaSuspend
set JPDA_SUSPEND=n
:gotJpdaSuspend
if not "%JPDA_OPTS%" == "" goto gotJpdaOpts
set JPDA_OPTS=-agentlib:jdwp=transport=%JPDA_TRANSPORT%,address=%JPDA_ADDRESS%,server=y,suspend=%JPDA_SUSPEND%
:gotJpdaOpts
shift
:noJpda

if ""%1"" == ""debug"" goto doDebug
if ""%1"" == ""run"" goto doRun
if ""%1"" == ""start"" goto doStart                rem  %1 为start 所以转到doStart
if ""%1"" == ""stop"" goto doStop
if ""%1"" == ""configtest"" goto doConfigTest
if ""%1"" == ""version"" goto doVersion

echo Usage:  catalina ( commands ... )
echo commands:
echo   debug             Start Catalina in a debugger
echo   debug -security   Debug Catalina with a security manager
echo   jpda start        Start Catalina under JPDA debugger
echo   run               Start Catalina in the current window
echo   run -security     Start in the current window with security manager
echo   start             Start Catalina in a separate window
echo   start -security   Start in a separate window with security manager
echo   stop              Stop Catalina
echo   configtest        Run a basic syntax check on server.xml
echo   version           What version of tomcat are you running?
goto end

:doDebug
shift
set _EXECJAVA=%_RUNJDB%
set DEBUG_OPTS=-sourcepath "%CATALINA_HOME%\..\..\java"
if not ""%1"" == ""-security"" goto execCmd
shift
echo Using Security Manager
set "SECURITY_POLICY_FILE=%CATALINA_BASE%\conf\catalina.policy"
goto execCmd

:doRun
shift
if not ""%1"" == ""-security"" goto execCmd
shift
echo Using Security Manager
set "SECURITY_POLICY_FILE=%CATALINA_BASE%\conf\catalina.policy"
goto execCmd

:doStart
shift          rem 参数左移
if "%TITLE%" == "" set TITLE=Tomcat  rem 如果%TITLE%为""  ,则设置为Tomcat
set _EXECJAVA=start "%TITLE%" %_RUNJAVA%  rem 设置_EXECJAVA
if not ""%1"" == ""-security"" goto execCmd rem 如果%1 不为"-security" ,这里不为-security,直接转到execCmd
shift
echo Using Security Manager
set "SECURITY_POLICY_FILE=%CATALINA_BASE%\conf\catalina.policy"
goto execCmd

:doStop
shift
set ACTION=stop
set CATALINA_OPTS=
goto execCmd

:doConfigTest
shift
set ACTION=configtest
set CATALINA_OPTS=
goto execCmd

:doVersion
%_EXECJAVA% -classpath "%CATALINA_HOME%\lib\catalina.jar" org.apache.catalina.util.ServerInfo
goto end


:execCmd
rem Get remaining unshifted command line arguments and save them in the
set CMD_LINE_ARGS=                rem 清空CMD_LINE_ARGS
:setArgs
if ""%1""=="""" goto doneSetArgs  rem 第一个参数为 "" 转到doneSetArgs,这里在 doStart时 shift了,所以第一个参数没有了,即"" ,所以直接转到doneSetArgs
set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
shift
goto setArgs
:doneSetArgs

rem Execute Java with the applicable properties
if not "%JPDA%" == "" goto doJpda   rem 如果%JPDA% 不为空就转到doJpda,这里为""  继续执行
if not "%SECURITY_POLICY_FILE%" == "" goto doSecurity  rem SECURITY_POLICY_FILE 不为空 成立 所以继续执行,所以直接执行 下面的这一段
%_EXECJAVA% %LOGGING_CONFIG% %LOGGING_MANAGER% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -D%ENDORSED_PROP%="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%
rem 翻译上面 的串如下
rem 开始
rem start "Tomcat" "D:\WorkSoftware\Java\jdk1.8...\bin\java"  
rem -Djava.util.logging.config.file="E:\xx\tomcat7.0\conf\logging.properties" 
rem	-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager   
rem	-Djava.endorsed.dirs="E:\xx\tomcat7.0\endorsed" 
rem	-classpath "E:\xx\tomcat7.0\bin\bootstrap.jar;E:\xx\tomcat7.0\bin\tomcat-juli.jar" 
rem	-Dcatalina.base="E:\xx\tomcat7.0" -Dcatalina.home="E:\xx\tomcat7.0" 
rem	-Djava.io.tmpdir="E:\xx\tomcat7.0\temp" 
rem	org.apache.catalina.startup.Bootstrap  start
rem 结束
rem  新开一个窗口,窗口名字叫做Tomcat 使用java.exe,各种参数配置,最后调用org.apache.catalina.startup.Bootstrap类,(类入口当然是main方法)传递参数为start!!!

rem :总结 tomcat启动入口是startup.bat文件,该文件会设置CATALINA_HOME,CATALINA_BASE等常见变量,并且调用catalina.bat文件,传递start参数。
rem       catalina.bat文件,所做的事情就是检查关键文件是否存在,设置关键变量,例如CATALINA_HOME,CATALINA_BASE,classpath等等,最后新开一个窗口调用Bootstrap类的main方法,传递参数start,并且将一大堆配置传递过去。
goto end
:doSecurity
%_EXECJAVA% %LOGGING_CONFIG% %LOGGING_MANAGER% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -D%ENDORSED_PROP%="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Djava.security.manager -Djava.security.policy=="%SECURITY_POLICY_FILE%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%
goto end
:doJpda
if not "%SECURITY_POLICY_FILE%" == "" goto doSecurityJpda
%_EXECJAVA% %LOGGING_CONFIG% %LOGGING_MANAGER% %JAVA_OPTS% %JPDA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -D%ENDORSED_PROP%="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%
goto end
:doSecurityJpda
%_EXECJAVA% %LOGGING_CONFIG% %LOGGING_MANAGER% %JAVA_OPTS% %JPDA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -D%ENDORSED_PROP%="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Djava.security.manager -Djava.security.policy=="%SECURITY_POLICY_FILE%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%
goto end

:end

复制代码

转载于:https://juejin.im/post/5acdaf566fb9a028b4116b25

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值