There are two environment variables - CATALINA_OPTS and JAVA_OPTS - which are both used in the catalina.sh startup and shutdown script for Tomcat. They are described in comments within that file as:
(optional)
Java runtime options used when the "start", "stop" or "run" command is executed [JAVA_OPTS]
and
(optional)
Java runtime options used when the "start" or "run" command is executed [CATALINA_OPTS]
So why are there two different variables? And what's the difference?
Firstly, anything specified in EITHER variable is passed, identically, to the command that starts up Tomcat - the "start" or "run" command - but only values set in JAVA_OPTS are passed to the "stop" command. That probably doesn't make any difference to how Tomcat runs in practise as it only effects the end of a run, not the start.
The second difference is more subtle. Other applications may also use JAVA_OPTS, but only Tomcat will use CATALINA_OPTS. So if you're setting environment variables for use only by Tomcat, you'll be best advised to use CATALINA_OPTS, whereas if you're setting environment variables to be used by other java applications as well, such as by JBoss, you should put your settings in JAVA_OPTS
分享到:
相关推荐
catalina-jmx-remote.jar放到tomcat/lib目录下 如果是windows版本,编辑TOMCAT_HOME/bin/catalina.bat,在开头加入下面几行: set CATALINA_OPTS=%CATALINA_OPTS% -Djava.rmi.server.hostname=JMX_HOST set CATALINA...
catalina.bat setclasspath.bat 上一篇咱们分析了 startup.bat 脚本 这一篇咱们来分析 catalina.bat 脚本. 至于 setclasspath.bat 这个脚本, 相信看完这一篇, 就可以自己看懂这个脚本了. 可以点击下载 [ set...
CATALINA_OPTS="-Dconfluence.document.conversion.fontpath=/usr/share/fonts/msttcore/ ${CATALINA_OPTS}" ``` 3. **清理缓存**:清理相关缓存文件夹,例如`home`下的`viewfile`目录和`shared-home/dcl-document...
添加:JAVA_OPTS=’-Xms512m -Xmx1024m’ 或者 JAVA_OPTS=”-server -Xms800m -Xmx800m -XX:MaxNewSize=256m” 或者 CATALINA_OPTS=”-server -Xms256m -Xmx300m” Windows服务器: 在/apache-tomcat-5.5.23/bin ...
set JAVA_OPTS=%JAVA_OPTS% -Djava.util.logging.config.file="%CATALINA_BASE%\conf\logging.properties" set JAVA_OPTS=%JAVA_OPTS% -Xmx512m echo Using CATALINA_BASE: %CATALINA_BASE% set JAVA_OPTS=%JAVA...
`Catalina.bat` 是Tomcat在Windows环境下启动的批处理文件,主要负责设置环境变量、执行Java虚拟机(JVM)并加载Tomcat的核心类。解析这个脚本有助于理解Tomcat的启动过程,包括如何设置系统路径、JVM参数以及初始...
CATALINA_OPTS="${CATALINA_OPTS}-Djava.rmi.server.hostname=162.16.10.53" CATALINA_OPTS="${CATALINA_OPTS}-Djavax.management.builder.initial=" CATALINA_OPTS="${CATALINA_OPTS}-Dcom.sun.management....
2. 修改Catalina.bat文件:可以修改Catalina.bat文件的内容,例如,在166行添加以下命令:`%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%...
Tomcat是一个流行的开源Java Servlet容器,用于运行基于Java的Web应用程序。在Tomcat的使用过程中,配置CATALINA_HOME环境变量是一个重要步骤。通过本文的分析,我们将深入理解为什么需要配置CATALINA_HOME环境变量...
在IT领域,特别是Java应用服务器环境,如Apache Tomcat中,遇到`java.lang.OutOfMemoryError`异常是常见的性能瓶颈之一。此错误通常表明应用程序所消耗的内存超过了JVM(Java虚拟机)分配的限制。根据给定的文件信息...
Linux下,tomcat自动获取CATALINA_HOME的脚本,放到startup.sh同级目录下即可
可以使用UE文件编辑器打开catalina.sh文件,并添加JAVA_HOME和CATALINA_OPTS变量,例如:JAVA_HOME=/usr/java6_64;CATALINA_OPTS=-Xmx1024m。然后,执行sh startup.sh命令启动Tomcat。 三、配置Tomcat Tomcat的...
SET CATALINA_OPTS=%CATALINA_OPTS% -Djava.naming.factory.initial=org.apache.naming.java.javaNamingFactory SET CATALINA_OPTS=%CATALINA_OPTS% -Djava.naming.provider.url=java:comp/env ``` 完成上述配置...
- 在`$CATALINA_HOME/bin/catalina.sh`(或`catalina.bat`,根据你的操作系统)文件中,找到`JAVA_OPTS`变量并添加以下行: ``` export JAVA_OPTS="$JAVA_OPTS -Djava.library.path=/usr/lib/jni" ``` - 或者,...
或者,打开 Tomcat 根目录下的 bin 文件夹,编辑 catalina.bat,将其中的%CATALINA_OPTS%替换为: -Xmx128m -Xms64m -Xmn32m -Xss16m 三、 JVM 内存设置的重要性 合理地设置 JVM 内存可以提高 Java 程序的性能,...
set JAVA_OPTS=%JAVA_OPTS% -server -XX:PermSize=128M -XX:MaxPermSize=512m ``` - 对于Linux系统,修改`catalina.sh`,同样在相应位置添加: ``` JAVA_OPTS="$JAVA_OPTS -server -XX:PermSize=128M -XX:...
Dell Optiplex 3020 MT 最新 黑苹果 EFI ,基于 OpenCore 0.6.2 可以启动 Catalina 10.15.7 及 Big Sur 11.0.1 修复了关于本机中机型及CPU型号的显示,以及关闭了启动时EFI的日志
本文将围绕如何通过调整`catalina.sh`中的`CATALINA_OPTS`来优化内存分配、垃圾回收机制等方面,帮助大家更好地理解和实践Tomcat的性能调优。 #### CATALINA_OPTS详解 `CATALINA_OPTS`是`catalina.sh`脚本中的一个...
set JAVA_OPTS=%JAVA_OPTS%%LOGGING_MANAGER%-Xms64m-Xmx1024m-server-XX:PermSize=128M-XX:MaxPermSize=512M ``` 接下来将详细介绍这些配置项的意义及用法。 #### `JAVA_OPTS` `JAVA_OPTS`环境变量用于定义启动...