`
jia106329
  • 浏览: 62797 次
  • 性别: Icon_minigender_2
  • 来自: tj
社区版块
存档分类
最新评论

tomcat catalina.bat

阅读更多
@echo off
if "%OS%" == "Windows_NT" setlocal
rem ---------------------------------------------------------------------------
rem Start/Stop Script for the CATALINA Server
rem
rem Environment Variable Prequisites
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                   "stop", or "run" command is executed.
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.
rem
rem   JAVA_OPTS       (Optional) Java runtime options used when the "start",
rem                   "stop", or "run" command is executed.
rem
rem   JSSE_HOME       (Optional) May point at your Java Secure Sockets Extension
rem                   (JSSE) installation, whose JAR files will be added to the
rem                   system class path used to start Tomcat.
rem
rem   JPDA_TRANSPORT  (Optional) JPDA transport used when the "jpda start"
rem                   command is executed. The default is "dt_shmem".
rem
rem   JPDA_ADDRESS    (Optional) Java runtime options used when the "jpda start"
rem                   command is executed. The default is "jdbconn".
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                   -Xdebug -Xrunjdwp:transport=%JPDA_TRANSPORT%,
rem                       address=%JPDA_ADDRESS%,server=y,suspend=%JPDA_SUSPEND%
rem
rem $Id: catalina.bat 537518 2007-05-12 21:11:40Z markt $
rem ---------------------------------------------------------------------------

rem Guess CATALINA_HOME if not defined
set JAVA_OPTS=-Xms1024m -Xmx2048m
set JAVA_OPTS=-Dfile.encoding=UTF-8

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 Get standard environment variables
if exist "%CATALINA_HOME%\bin\setenv.bat" call "%CATALINA_HOME%\bin\setenv.bat"

rem Get standard Java environment variables
if exist "%CATALINA_HOME%\bin\setclasspath.bat" goto okSetclasspath
echo Cannot find %CATALINA_HOME%\bin\setclasspath.bat
echo This file is needed to run this program
goto end
:okSetclasspath
set BASEDIR=%CATALINA_HOME%
call "%CATALINA_HOME%\bin\setclasspath.bat" %1
if errorlevel 1 goto end

rem Add on extra jar files to CLASSPATH
if "%JSSE_HOME%" == "" goto noJsse
set CLASSPATH=%CLASSPATH%;%JSSE_HOME%\lib\jcert.jar;%JSSE_HOME%\lib\jnet.jar;%JSSE_HOME%\lib\jsse.jar
:noJsse
set CLASSPATH=%CLASSPATH%;%CATALINA_HOME%\bin\bootstrap.jar

if not "%CATALINA_BASE%" == "" goto gotBase
set CATALINA_BASE=%CATALINA_HOME%
:gotBase

if not "%CATALINA_TMPDIR%" == "" goto gotTmpdir
set CATALINA_TMPDIR=%CATALINA_BASE%\temp
:gotTmpdir

if not exist "%CATALINA_HOME%\conf\logging.properties" goto noJuli
set JAVA_OPTS=%JAVA_OPTS% -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file="%CATALINA_BASE%\conf\logging.properties"
:noJuli

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

echo Using CATALINA_BASE:   %CATALINA_BASE%
echo Using CATALINA_HOME:   %CATALINA_HOME%
echo Using CATALINA_TMPDIR: %CATALINA_TMPDIR%
if ""%1"" == ""debug"" goto use_jdk
echo Using JRE_HOME:        %JRE_HOME%
goto java_dir_displayed
:use_jdk
echo Using JAVA_HOME:       %JAVA_HOME%
:java_dir_displayed

set _EXECJAVA=%_RUNJAVA%
set MAINCLASS=org.apache.catalina.startup.Bootstrap
set ACTION=start
set SECURITY_POLICY_FILE=
set DEBUG_OPTS=
set JPDA=

if not ""%1"" == ""jpda"" goto noJpda
set JPDA=jpda
if not "%JPDA_TRANSPORT%" == "" goto gotJpdaTransport
set JPDA_TRANSPORT=dt_shmem
:gotJpdaTransport
if not "%JPDA_ADDRESS%" == "" goto gotJpdaAddress
set JPDA_ADDRESS=jdbconn
:gotJpdaAddress
shift
:noJpda

if ""%1"" == ""debug"" goto doDebug
if ""%1"" == ""run"" goto doRun
if ""%1"" == ""start"" goto doStart
if ""%1"" == ""stop"" goto doStop
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   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
if not "%OS%" == "Windows_NT" goto noTitle
set _EXECJAVA=start "LTXM" %_RUNJAVA%
goto gotTitle
:noTitle
set _EXECJAVA=start %_RUNJAVA%
:gotTitle
if not ""%1"" == ""-security"" goto execCmd
shift
echo Using Security Manager
set SECURITY_POLICY_FILE=%CATALINA_BASE%\conf\catalina.policy
goto execCmd

:doStop
shift
set ACTION=stop
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=
:setArgs
if ""%1""=="""" goto 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
if not "%SECURITY_POLICY_FILE%" == "" goto doSecurity
%_EXECJAVA% %JAVA_OPTS% -Xms512m -Xmx800m %DEBUG_OPTS% -Djava.endorsed.dirs="%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
:doSecurity
%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%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% %JAVA_OPTS% %CATALINA_OPTS% -Xdebug -Xrunjdwp:transport=%JPDA_TRANSPORT%,address=%JPDA_ADDRESS%,server=y,suspend=n %DEBUG_OPTS% -Djava.endorsed.dirs="%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% %JAVA_OPTS% %CATALINA_OPTS% -Xdebug -Xrunjdwp:transport=%JPDA_TRANSPORT%,address=%JPDA_ADDRESS%,server=y,suspend=n %DEBUG_OPTS% -Djava.endorsed.dirs="%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
分享到:
评论

相关推荐

    解析Tomcat的启动脚本–catalina.bat

    catalina.bat setclasspath.bat 上一篇咱们分析了 startup.bat 脚本 这一篇咱们来分析 catalina.bat 脚本. 至于 setclasspath.bat 这个脚本, 相信看完这一篇, 就可以自己看懂这个脚本了. 可以点击下载 [ set...

    windows下tomcat的catalina.out按天自动分割

    接下来,我们将逐步介绍如何对`startup.bat`和`catalina.bat`两个脚本文件进行修改,以实现日志文件的自动分割功能。 1. **修改`startup.bat`文件** - 打开`bin/startup.bat`文件。 - 查找并修改`call "%...

    tomcat8.0 catalina.bat

    服务器应用,web服务器,windows下 tomcat8.0配置文件

    Tomcat中的catalina.bat原理详细解析

    本文主要给大家详细解析了关于Tomcat中catalina.bat原理的相关内容,分享出来供大家参考学习,下面话不多说了,来一起看看详细的介绍吧。 tomcat 的真正启动是在 catalina.bat 设置并启动的。startup.bat 只是找到...

    service.bat文件(Tomcat)

    4. **设置环境变量**:有时需要为Tomcat服务指定特定的环境变量,如`CATALINA_HOME` 和 `JAVA_HOME`。这些可以通过`--Environment` 参数添加。 5. **控制服务状态**:一旦服务安装完毕,您可以使用`start`、`stop`...

    apache-tomcat-9.0.86-windows-x64.zip

    5. **启动和管理**:通过运行`bin/startup.bat`脚本启动Tomcat,使用`bin/shutdown.bat`关闭。还可以使用`bin/catalina.sh`或`catalina.bat`脚本来控制更多服务选项。 6. **Web应用程序部署**:将WAR文件(Web应用...

    tomcat8.5.59

    3. 启动与停止:使用`bin/startup.sh`(Unix/Linux)或`bin/startup.bat`(Windows)启动Tomcat,`bin/shutdown.sh`或`bin/shutdown.bat`则用于关闭服务器。 4. 配置与管理:通过修改`conf/server.xml`配置文件,...

    tomcat7.0.109下载

    2. **启动与停止**:Tomcat服务器可以通过`bin/startup.sh`(Unix/Linux)或`bin/startup.bat`(Windows)脚本来启动,相应地,使用`bin/shutdown.sh`或`bin/shutdown.bat`来关闭服务器。 3. **Web应用程序部署**:...

    tomcat下用Log4j 按文件大小,生成catalina.out日志文件

    同时,确保Tomcat启动脚本(`catalina.sh`或`catalina.bat`)包含以下行来加载Log4j配置: ```bash -Dlog4j.configuration=file:${catalina.base}/conf/log4j.properties ``` 这样,Tomcat就会使用Log4j进行日志...

    tomcat 8.5.100

    - **启动与停止**:通过运行`bin/startup.sh`(Unix/Linux)或`bin/startup.bat`(Windows)来启动Tomcat,使用`shutdown.sh`或`shutdown.bat`来停止服务。 3. **配置文件**: - **server.xml**:这是Tomcat的...

    将tomcat的startup.bat改为系统服务的方法

    5. 运行`service.bat`脚本,你需要设置一个环境变量`CATALINA_HOME`,指向Tomcat的安装或解压目录,例如`c:\Apache tomcat6.0`。 6. 在CMD中执行`service.bat install Tomcat`命令,创建名为"Tomcat"的系统服务。...

    tomcat9.0.85可用版本压缩包

    下载并解压apache-tomcat-9.0.85压缩包后,可以配置环境变量,如CATALINA_HOME指向Tomcat的安装目录。然后,可以通过bin目录下的startup.sh或startup.bat脚本来启动服务器,shutdown.sh或shutdown.bat则用于关闭...

    apache-tomcat-7.0.100-windows-x64.zip

    1. **bin** 目录:包含了启动和停止Tomcat的脚本,如`startup.bat`和`shutdown.bat`,以及用于管理应用程序的工具,如`catalina.bat`和`tomcat7.exe`。 2. **conf** 目录:存储服务器配置文件,如`server.xml`...

    Tomcat8安装包,Tomcat安装包-8.5.85版本

    4. **启动与管理**:通过`bin`目录下的脚本启动Tomcat,如`./catalina.sh start`(Unix/Linux)或`catalina.bat start`(Windows)。可以通过`./catalina.sh stop`或`catalina.bat stop`来停止服务。`manager`和`...

    apache-tomcat7.0.100windows和linux版本安全版本.zip

    5. **JVM内存设置**:根据应用需求,可能需要调整JVM的内存分配,这可以通过修改`bin/catalina.sh`或`bin/catalina.bat`中的`JAVA_OPTS`环境变量实现。 6. **HTTPS支持**:若需提供加密通信,可以在`server.xml`中...

    tomcat9.0.83压缩包

    4. **启动Tomcat**:使用`bin/startup.sh`(Unix/Linux)或`bin/startup.bat`(Windows)启动Tomcat服务。 5. **Jenkins部署**:下载Jenkins的最新war文件,将其放入Tomcat的`webapps`目录下,文件名通常是`jenkins....

    jakarta-tomcat-catalina.rar_The Bat

    This temp directory is used by the JVM for temporary file storage. The JVM is configured to use this as its java.io.tmpdir in the catalina.sh and catalina.bat scripts.

    apache-tomcat-8.5.100.tar.gz

    - 启动与停止:通过bin目录下的startup.sh或startup.bat启动Tomcat,使用shutdown.sh或shutdown.bat停止。 2. 使用Apache Tomcat托管Web应用: - 将WAR文件放入webapps目录下,Tomcat会自动解压并部署应用。 - ...

Global site tag (gtag.js) - Google Analytics