本文主要是介绍Tomcat ava.lang.UnsupportedClassVersionError: Bad version number in .class file,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
我用的是xampp的tomcat addon
运行tomcat自带的jsp例子遇到如下问题:
ava.lang.UnsupportedClassVersionError: Bad version number in .class file
我机子上的jdk是1.6..0_10,位置如下
set JAVA_HOME=C:/Program Files/Java/jdk1.6.0_10
而tomcat用的jdk还是1.5
如下办法解决:
修改Tomcat的JDK目录
打开tomcat/bin/catalina.bat,找到如下所示的最后一条语句:
rem $Id: catalina.bat 656834 2008-05-15 21:04:04Z markt $
rem ---------------------------------------------------------------------------
在该语句下面添加如下语句:
rem JSSE_HOME (Optional) May point at your Java Secure Sockets Extension
rem (JSSE) installation, whose JAR files will be added to the
rem system class path used to start Tomcat.
rem
rem JPDA_TRANSPORT (Optional) JPDA transport used when the "jpda start"
rem command is executed. The default is "dt_shmem".
rem
rem JPDA_ADDRESS (Optional) Java runtime options used when the "jpda start"
rem command is executed. The default is "jdbconn".
rem
rem $Id: catalina.bat 355227 2005-12-08 21:44:16Z keith $
rem ---------------------------------------------------------------------------
set JAVA_HOME=C:/Program Files/Java/jdk1.6.0_10
注意:其中最后一条语句是JDK的路径,该值根据你的JDK安装情况而定。
重启tomcat就可以了
这篇关于Tomcat ava.lang.UnsupportedClassVersionError: Bad version number in .class file的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!