jprofile 配置 以及jvm参数配置

Simbacheng 2011-01-22

@echooff

if"%OS%"=="Windows_NT"setlocal

rem---------------------------------------------------------------------------

remStart/StopScriptfortheCATALINAServer

rem

remEnvironmentVariablePrequisites

rem

remCATALINA_HOMEMaypointatyourCatalina"build"directory.

rem

remCATALINA_BASE(Optional)Basedirectoryforresolvingdynamicportions

remofaCatalinainstallation.Ifnotpresent,resolvesto

remthesamedirectorythatCATALINA_HOMEpointsto.

rem

remCATALINA_OPTS(Optional)Javaruntimeoptionsusedwhenthe"start",

remor"run"commandisexecuted.

rem

remCATALINA_TMPDIR(Optional)Directorypathlocationoftemporarydirectory

remtheJVMshoulduse(java.io.tmpdir).Defaultsto

rem%CATALINA_BASE%\temp.

rem

remJAVA_HOMEMustpointatyourJavaDevelopmentKitinstallation.

remRequiredtorunthewiththe"debug"argument.

rem

remJRE_HOMEMustpointatyourJavaRuntimeinstallation.

remDefaultstoJAVA_HOMEifempty.

rem

remJAVA_OPTS(Optional)Javaruntimeoptionsusedwhenthe"start",

rem"stop",or"run"commandisexecuted.

rem

remJSSE_HOME(Optional)MaypointatyourJavaSecureSocketsExtension

rem(JSSE)installation,whoseJARfileswillbeaddedtothe

remsystemclasspathusedtostartTomcat.

rem

remJPDA_TRANSPORT(Optional)JPDAtransportusedwhenthe"jpdastart"

remcommandisexecuted.Thedefaultis"dt_shmem".

rem

remJPDA_ADDRESS(Optional)Javaruntimeoptionsusedwhenthe"jpdastart"

remcommandisexecuted.Thedefaultis"jdbconn".

rem

remJPDA_SUSPEND(Optional)Javaruntimeoptionsusedwhenthe"jpdastart"

remcommandisexecuted.SpecifieswhetherJVMshouldsuspend

remexecutionimmediatelyafterstartup.Defaultis"n".

rem

remJPDA_OPTS(Optional)Javaruntimeoptionsusedwhenthe"jpdastart"

remcommandisexecuted.Ifused,JPDA_TRANSPORT,JPDA_ADDRESS,

remandJPDA_SUSPENDareignored.Thus,allrequiredjpda

remoptionsMUSTbespecified.Thedefaultis:

rem

rem-Xdebug-Xrunjdwp:transport=%JPDA_TRANSPORT%,

remaddress=%JPDA_ADDRESS%,server=y,suspend=%JPDA_SUSPEND%

rem

rem$Id:catalina.bat5375172007-05-1221:11:17Zmarkt$

rem---------------------------------------------------------------------------

remGuessCATALINA_HOMEifnotdefined

setCURRENT_DIR=%cd%

ifnot"%CATALINA_HOME%"==""gotogotHome

setCATALINA_HOME=%CURRENT_DIR%

ifexist"%CATALINA_HOME%\bin\catalina.bat"gotookHome

cd..

setCATALINA_HOME=%cd%

cd%CURRENT_DIR%

:gotHome

ifexist"%CATALINA_HOME%\bin\catalina.bat"gotookHome

echoTheCATALINA_HOMEenvironmentvariableisnotdefinedcorrectly

echoThisenvironmentvariableisneededtorunthisprogram

gotoend

:okHome

remGetstandardenvironmentvariables

ifexist"%CATALINA_HOME%\bin\setenv.bat"call"%CATALINA_HOME%\bin\setenv.bat"

remGetstandardJavaenvironmentvariables

ifexist"%CATALINA_HOME%\bin\setclasspath.bat"gotookSetclasspath

echoCannotfind%CATALINA_HOME%\bin\setclasspath.bat

echoThisfileisneededtorunthisprogram

gotoend

:okSetclasspath

setBASEDIR=%CATALINA_HOME%

call"%CATALINA_HOME%\bin\setclasspath.bat"%1

iferrorlevel1gotoend

remAddonextrajarfilestoCLASSPATH

if"%JSSE_HOME%"==""gotonoJsse

setCLASSPATH=%CLASSPATH%;%JSSE_HOME%\lib\jcert.jar;%JSSE_HOME%\lib\jnet.jar;%JSSE_HOME%\lib\jsse.jar

:noJsse

setCLASSPATH=%CLASSPATH%;%CATALINA_HOME%\bin\bootstrap.jar

ifnot"%CATALINA_BASE%"==""gotogotBase

setCATALINA_BASE=%CATALINA_HOME%

:gotBase

ifnot"%CATALINA_TMPDIR%"==""gotogotTmpdir

setCATALINA_TMPDIR=%CATALINA_BASE%\temp

:gotTmpdir

ifnotexist"%CATALINA_HOME%\bin\tomcat-juli.jar"gotonoJuli

setJAVA_OPTS=%JAVA_OPTS%-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager-Djava.util.logging.config.file="%CATALINA_BASE%\conf\logging.properties"

:noJuli

rem-----ExecuteTheRequestedCommand---------------------------------------

rem-----setJAVA_OPTS=-Xms800m-Xmx800m--------

setJAVA_OPTS=-Xms200M-Xmx500M-XX:PermSize=128M-XX:MaxPermSize=256m-verbose:gc-Xloggc:../logs/gclog.log-XX:+PrintGCDetails-XX:+PrintGCTimeStamps-XX:+PrintHeapAtGC-XX:+PrintTenuringDistribution-XX:+HeapDumpOnOutOfMemoryError%JAVA_OPTS%

echoUsingCATALINA_BASE:%CATALINA_BASE%

echoUsingCATALINA_HOME:%CATALINA_HOME%

echoUsingCATALINA_TMPDIR:%CATALINA_TMPDIR%

if""%1""==""debug""gotouse_jdk

echoUsingJRE_HOME:%JRE_HOME%

gotojava_dir_displayed

:use_jdk

echoUsingJAVA_HOME:%JAVA_HOME%

:java_dir_displayed

set_EXECJAVA=%_RUNJAVA%

setMAINCLASS=org.apache.catalina.startup.Bootstrap

setACTION=start

setSECURITY_POLICY_FILE=

setDEBUG_OPTS=

setJPDA=

ifnot""%1""==""jpda""gotonoJpda

setJPDA=jpda

ifnot"%JPDA_TRANSPORT%"==""gotogotJpdaTransport

setJPDA_TRANSPORT=dt_shmem

:gotJpdaTransport

ifnot"%JPDA_ADDRESS%"==""gotogotJpdaAddress

setJPDA_ADDRESS=jdbconn

:gotJpdaAddress

ifnot"%JPDA_SUSPEND%"==""gotogotJpdaSuspend

setJPDA_SUSPEND=n

:gotJpdaSuspend

ifnot"%JPDA_OPTS%"==""gotogotJpdaOpts

setJPDA_OPTS=-Xdebug-Xrunjdwp:transport=%JPDA_TRANSPORT%,address=%JPDA_ADDRESS%,server=y,suspend=%JPDA_SUSPEND%

:gotJpdaOpts

shift

:noJpda

if""%1""==""debug""gotodoDebug

if""%1""==""run""gotodoRun

if""%1""==""start""gotodoStart

if""%1""==""stop""gotodoStop

if""%1""==""version""gotodoVersion

echoUsage:catalina(commands...)

echocommands:

echodebugStartCatalinainadebugger

echodebug-securityDebugCatalinawithasecuritymanager

echojpdastartStartCatalinaunderJPDAdebugger

echorunStartCatalinainthecurrentwindow

echorun-securityStartinthecurrentwindowwithsecuritymanager

echostartStartCatalinainaseparatewindow

echostart-securityStartinaseparatewindowwithsecuritymanager

echostopStopCatalina

echoversionWhatversionoftomcatareyourunning?

gotoend

:doDebug

shift

set_EXECJAVA=%_RUNJDB%

setDEBUG_OPTS=-sourcepath"%CATALINA_HOME%\..\..\jakarta-tomcat-catalina\catalina\src\share"

ifnot""%1""==""-security""gotoexecCmd

shift

echoUsingSecurityManager

setSECURITY_POLICY_FILE=%CATALINA_BASE%\conf\catalina.policy

gotoexecCmd

:doRun

shift

ifnot""%1""==""-security""gotoexecCmd

shift

echoUsingSecurityManager

setSECURITY_POLICY_FILE=%CATALINA_BASE%\conf\catalina.policy

gotoexecCmd

:doStart

shift

ifnot"%OS%"=="Windows_NT"gotonoTitle

set_EXECJAVA=start"Tomcat"%_RUNJAVA%

gotogotTitle

:noTitle

set_EXECJAVA=start%_RUNJAVA%

:gotTitle

ifnot""%1""==""-security""gotoexecCmd

shift

echoUsingSecurityManager

setSECURITY_POLICY_FILE=%CATALINA_BASE%\conf\catalina.policy

gotoexecCmd

:doStop

shift

setACTION=stop

setCATALINA_OPTS=

gotoexecCmd

:doVersion

%_EXECJAVA%-classpath"%CATALINA_HOME%\server\lib\catalina.jar"org.apache.catalina.util.ServerInfo

gotoend

:execCmd

remGetremainingunshiftedcommandlineargumentsandsavetheminthe

setCMD_LINE_ARGS=

:setArgs

if""%1""==""""gotodoneSetArgs

setCMD_LINE_ARGS=%CMD_LINE_ARGS%%1

shift

gotosetArgs

:doneSetArgs

remExecuteJavawiththeapplicableproperties

ifnot"%JPDA%"==""gotodoJpda

ifnot"%SECURITY_POLICY_FILE%"==""gotodoSecurity

%_EXECJAVA%%JAVA_OPTS%%CATALINA_OPTS%%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%

gotoend

: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%

gotoend

:doJpda

ifnot"%SECURITY_POLICY_FILE%"==""gotodoSecurityJpda

%_EXECJAVA%%JAVA_OPTS%%CATALINA_OPTS%%JPDA_OPTS%%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%

gotoend

:doSecurityJpda

%_EXECJAVA%%JAVA_OPTS%%CATALINA_OPTS%%JPDA_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%

gotoend

:end

相关推荐