Tomcat6和Java 7 [英] Tomcat6 and Java 7
问题描述
在linux中,是否可以在tomcat6上部署使用Java 7编写的Web应用程序?如果是这样,需要修改哪些配置才能使其正常工作?
In linux, is it possible to have a web application written using Java 7 be deployed on tomcat6? If so, what configuration needs to be modified to allow it to work?
我试过更改 JAVA_HOME
变量在 tomcat6.conf
文件中并重新启动,但根据tomcat管理器网页仍然使用1.6,并且只有1.6或更低版本的应用程序正确部署。
I have tried changing the JAVA_HOME
variable in the tomcat6.conf
file and restarting, but it is still using 1.6 according to the tomcat manager webpage, and only applications written in 1.6 or lower deploy correctly.
我在不同地点安装了jdk 1.6和1.7。
I have both jdk 1.6 and 1.7 installed in different locations.
推荐答案
我有当我使用Java JDK 1.7.0编译我的servlet时,一个主要问题是Tomcat由于运行时manor.major版本错误而无法启动。
I had a major problem when I compiled my servlet using java JDK 1.7.0, Tomcat wouldn't start up due of a runtime manor.major version error.
使Tomcat6运行使用JDK 1.7的类执行以下操作:
To make Tomcat6 run your classes using JDK 1.7 do the following:
-
打开文件
/etc/init.d/具有root权限的tomcat6
。
您将找到一个名为 JDK_DIRS
的变量第83行。
You will find a variable called JDK_DIRS
at line 83.
通过在行的开头添加#
来评论它。
Comment it out by adding #
at the beginning of the line.
写下来wing bellow it: JDK_DIRS =/ usr / lib / jvm / java-1.7.0-openjdk-i386
Write the following bellow it: JDK_DIRS="/usr/lib/jvm/java-1.7.0-openjdk-i386"
保存并重新启动tomcat
Save and restart tomcat
这篇关于Tomcat6和Java 7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!