0
set JAVA_HOME=
echo deploy web service ......
set CATALINA_HOME=%WEBTIER_HOME%
call "%CATALINA_HOME%\bin\service.bat" install %webtier%
"%CATALINA_HOME%\bin\tomcat7.exe" //US//%webtier% ++JvmOptions "-Djava.library.path=%installdir%\bin;-XX:MaxPermSize=256M;-Xms256m;-Xmx1024M"
set CATALINA_HOME=%WEBSERVICE_HOME%
call "%CATALINA_HOME%\bin\service.bat" install %webservice%
"%CATALINA_HOME%\bin\tomcat7.exe" //US//%webservice% ++JvmOptions "-Djava.library.path=%installdir%\bin;-XX:MaxPermSize=256M;-Xms256m;-Xmx1024M"

这是启动java web服务的.bat文件,但是有内存泄漏和堆错误,所以我想设置JAVA_OPTS,我可以直接添加“set JAVA_OPTS=-server -Xmx1024m”吗

set JAVA_HOME=
set JAVA_OPTS=-server -Xmx1024m
echo deploy web service ......
set CATALINA_HOME=%WEBTIER_HOME%
call "%CATALINA_HOME%\bin\service.bat" install %webtier%
"%CATALINA_HOME%\bin\tomcat7.exe" //US//%webtier% ++JvmOptions "-Djava.library.path=%installdir%\bin;-XX:MaxPermSize=256M;-Xms256m;-Xmx1024M"
set CATALINA_HOME=%WEBSERVICE_HOME%
call "%CATALINA_HOME%\bin\service.bat" install %webservice%
"%CATALINA_HOME%\bin\tomcat7.exe" //US//%webservice% ++JvmOptions "-Djava.library.path=%installdir%\bin;-XX:MaxPermSize=256M;-Xms256m;-Xmx1024M"

或在 -Djava.library.path 之后添加作为 JvmOptions 参数

4

1 回答 1

0

服务器将 JAVA_OPTS 环境变量附加到执行 java 命令的调用中。因此,您需要在调用语句之前设置 JAVA_OPTS,即

set JAVA_OPTS=-Xms512M -Xmx1024M

call "%CATALINA_HOME%\bin\service.bat" install %webtier%"%CATALINA_HOME%\bin\tomcat7.exe" //US//%webtier% ++JvmOptions "-Djava.library.path=%installdir%\bin;-XX:MaxPermSize=256M;-Xms256m;-Xmx1024M"
于 2017-12-25T06:40:10.397 回答