日期:2014-05-17  浏览次数:20743 次

增加windows下Tomcat运行时的内存

注意:本方法仅针对windows下非安装版本的Tomcat

1.命令行启动Tomcat的场合,修改%TOMCAT_HOME%\bin\catalina.bat

修正前:
rem ----- Execute The Requested Command ---------------------------------------

echo Using CATALINA_BASE:   "%CATALINA_BASE%"
echo Using CATALINA_HOME:   "%CATALINA_HOME%"
echo Using CATALINA_TMPDIR: "%CATALINA_TMPDIR%"


修正后:
rem ----- Execute The Requested Command ---------------------------------------

set JAVA_OPTS=%JAVA_OPTS% -Xms512m -Xms512m -XX:PermSize=512M
echo Using CATALINA_BASE:   "%CATALINA_BASE%"
echo Using CATALINA_HOME:   "%CATALINA_HOME%"
echo Using CATALINA_TMPDIR: "%CATALINA_TMPDIR%"

2.添加到windows服务的场合,修改%TOMCAT_HOME%\bin\service.bat,修正后重新添加一次服务就ok了

修正前:
"%EXECUTABLE%" //US//%SERVICE_NAME% --JvmOptions "-Dcatalina.base=%CATALINA_BASE%;-Dcatalina.home=%CATALINA_HOME%;-Djava.endorsed.dirs=%CATALINA_HOME%\endorsed" --StartMode jvm --StopMode jvm

修正后:
"%EXECUTABLE%" //US//%SERVICE_NAME% --JvmOptions "-Xms512m;-Xmx512m;-XX:PermSize=512M;-Dcatalina.base=%CATALINA_BASE%;-Dcatalina.home=%CATALINA_HOME%;-Djava.endorsed.dirs=%CATALINA_HOME%\endorsed" --StartMode jvm --StopMode jvm