通过安装 Tomcat(在 Ubuntu 18.04 上)后apt install tomcat8
,将 Java -Xmx 选项放在哪里以增加可用内存?
答案1
setenv.sh
在 中将环境变量 CATALINA_OPTS (或 JAVA_OPTS)设置到名为 的脚本中 CATALINA_BASE/bin
。
来自‘catalina.sh’:
Environment Variable Prerequisites
Do not set the variables in this script. Instead put them into a script
setenv.sh in CATALINA_BASE/bin to keep your customizations separate.
CATALINA_OPTS (Optional) Java runtime options used when the "start",
"run" or "debug" command is executed.
Include here and not in JAVA_OPTS all options, that should
only be used by Tomcat itself, not by the stop process,
the version command etc.
Examples are heap size, GC logging, JMX ports etc.
OR
JAVA_OPTS (Optional) Java runtime options used when any command
is executed.
Include here and not in CATALINA_OPTS all options, that
should be used by Tomcat and also by the stop process,
the version command etc.
Most options should go into CATALINA_OPTS.