本篇文章小编给大家分享一下java运行报错has been compiled by a more recent version of the Java Runtime解决方法,文章介绍的很详细,小编觉得挺不错的,现在分享给大家供大家参考,有需要的小伙伴们可以来看看。
javaweb运行报错:has been compiled by a more recent version of the Java Runtime (class file version 55.0)
报错信息:
Exception in thread "main" java.lang.UnsupportedClassVersionError: pers/cyz/BookManage has been compiled by a more recent version of the Java Runtime (class file version 54.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
解决方法:
在项目的属性里设置jdk版本,方法是右击项目-->properties-->java compiler --> Enable project specific settings -->将compiler compliance level设置为1.8,也就是与jvm一致的版本
一般这样的错误都是因为当前的jre不能对程序进行编译,Tomcat的版本高于JDK的版本导致的,当前运行的jdk是1.8而我用的Tomcat版本是Tomcat 9所以就会出现这个问题。
解决方法:
要么降低Tomcat的版本号,要么用更高的版本的JRE。
这里我选择使用高版本的JRE:
重启服务器再次运行项目,问题解决。
eclipse运行Java代码出现原因很多,具体问题具体分析。
解决方案:
如果是web项目,不要在打开的文件上右击,要到项目路径上去右击”run as“,之后选择“server”。
如果是mian方法项目,需要找到带有main方法的类,之后打开这个类,之后“run as”,之后选择“java applet”即可。
敢达决战官方正版 安卓版v6.7.9
下载敢达决战 安卓版v6.7.9
下载像素火影骨架佐助 (Perseverance Fire Shadow)手机版v1.16
下载要塞英雄 安卓版v33.20.0-39082670-Android
下载梦想城镇vivo最新版本 安卓版v12.0.1
梦想城镇vivo版是这款卡通风模拟经营类手游的渠道服版本,玩
怦然心动的瞬间 安卓版v1.0
怦然心动的瞬间是一款真人向的恋爱互动游戏,在游戏中玩家将扮演
曼尼汉堡店游戏 安卓版v1.0.3
曼尼汉堡店是一款非常好玩的精品恐怖类型冒险游戏,在这款游戏中
现代总统模拟器去广告版 安卓版v1.0.46
现代总统模拟器是一款休闲养成类游戏,可能对于不少的玩家来说都
现代总统模拟器付费完整版 安卓版v1.0.46
现代总统模拟器高级版在商店是需要付费的,相对于普通版本,高级