我试图通过在 catalina.bat 中添加 JAVA_OPTS 来增加tomcat内存,如下所示:
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
rem
rem
rem $Id: catalina.bat 1146096 2011-07-13 15:20:43Z markt $
rem ---------------------------------------------------------------------------
JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8
-server -Xms1536m -Xmx1536m
-XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m
-XX:MaxPermSize=512m -XX:+DisableExplicitGC
-XX:UseConcMarkSweepGC
-XX:CMSPermGenSweepingEnabled
-XX:CMSClassUnloadingEnabled"
但是在运行启动或关闭脚本时,我在CMD中遇到以下错误:
'JAVA_OPTS' is not recognized as an internal or external command,
operable program or batch file.
'-server' is not recognized as an internal or external command,
operable program or batch file.
The filename, directory name, or volume label syntax is incorrect.
The filename, directory name, or volume label syntax is incorrect.
The filename, directory name, or volume label syntax is incorrect.
The filename, directory name, or volume label syntax is incorrect.
The filename, directory name, or volume label syntax is incorrect.
请告知我为什么要这些。
答案 0 :(得分:16)
尝试:
set JAVA_OPTS=-Djava.awt.headless=true -Dfile.encoding=UTF-8 ^
-server -Xms1536m -Xmx1536m ^
-XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m ^
-XX:MaxPermSize=512m -XX:+DisableExplicitGC ^
-XX:+UseConcMarkSweepGC ^
-XX:+CMSClassUnloadingEnabled
set
命令设置环境变量。^
(插入符号)。答案 1 :(得分:0)
尝试删除每个新行末尾的空格。
JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8[ENTER]
-server -Xms1536m -Xmx1536m[ENTER]
...
答案 2 :(得分:-3)
在行尾添加反斜杠:\
:
JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 \
-server -Xms1536m -Xmx1536m \
-XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m \
-XX:MaxPermSize=512m -XX:+DisableExplicitGC \
-XX:UseConcMarkSweepGC \
-XX:CMSPermGenSweepingEnabled \
-XX:CMSClassUnloadingEnabled"