简体   繁体   English

如何更改Tomcats JVM版本?

[英]How to change Tomcats JVM version?

I have the Java JDK 1.7.0_21 installed on my Debian machine (along with others). 我在Debian机器上(以及其他机器上)安装了Java JDK 1.7.0_21。 I have configured Debain to use this JDK: 我已配置Debain以使用此JDK:

pi@raspberrypi ~ $ java -version
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) Client VM (build 23.21-b01, mixed mode)

From reading the notes in Tomcat catalina.sh, I understand that the Tomcat server should use the JAVA_HOME / JRE_HOME system variables 通过阅读Tomcat catalina.sh中的注释,我了解到Tomcat服务器应使用JAVA_HOME / JRE_HOME系统变量

#   JAVA_HOME       Must point at your Java Development Kit installation.
#                   Required to run the with the "debug" argument.
#
#   JRE_HOME        Must point at your Java Development Kit installation.
#                   Defaults to JAVA_HOME if empty.

I have set those to the proper directory. 我已经将它们设置到正确的目录。 Echoing the variables gives the following output: 回显变量将产生以下输出:

pi@raspberrypi ~ $ echo $JAVA_HOME
/opt/Oracle_Java/jdk1.7.0_21/bin
pi@raspberrypi ~ $ echo $JRE_HOME
/opt/Oracle_Java/jdk1.7.0_21/jre

The Tomcat Web Application Manager however still shows 1.6.0_27-b27 as the JVM in use. 但是,Tomcat Web应用程序管理器仍将1.6.0_27-b27显示为正在使用的JVM。

Do you have any advice on how to make Tomcat run with the 1.7.0_21 JDK? 您对如何使Tomcat与1.7.0_21 JDK一起运行有任何建议吗?

Navigate to the directory where Tomcat is installed, and go into the \\bin folder (/tomcat/bin). 导航到Tomcat的安装目录,然后进入\\ bin文件夹(/ tomcat / bin)。 Right-click the file catalina.bat, and then select Edit 右键单击文件catalina.bat,然后选择“编辑”。

Scroll down in the code until you pass the end of the beginning “rem” comments, and insert the following code pointing to your JDK's root directory: 向下滚动代码,直到传递“ rem”开头的注释的末尾,然后插入指向您的JDK根目录的以下代码:

     set JAVA_HOME=/opt/Oracle_Java/jdk1.7.0_21

Save your changes, and restart Tomcat. 保存更改,然后重新启动Tomcat。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM