MyEclipse报错:Unsupported major.minor version 52.0,已解决

左心房为你撑大大i 提交于 2020-01-19 00:09:00

今天@Test时项目出现了Error,如下

java.lang.UnsupportedClassVersionError: org/apache/ibatis/session/SqlSessionFactoryBuilder : Unsupported major.minor version 52.0
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
	at test.mybatisTest.test(mybatisTest.java:21)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

搜到了其他人的解释说Unsupported major.minor version 52.0是,jvm虚拟机的jdk与电脑的jdk版本不一致造成的。

原文链接

JDK版本 序号
Java SE 10 54 (0x36 hex)
Java SE 9 53 (0x35 hex)
Java SE 8 52 (0x34 hex)
Java SE 7 51 (0x33 hex)
Java SE 6.0 50 (0x32 hex)
Java SE 5.0 49(0x31 hex)
JDK 1.4 48 (0x30 hex)
JDK 1.3 47 (0x2F hex)
JDK 1.2 46 (0x2E hex)
JDK 1.1 45 (0x2D hex)

 

验证:

电脑jdk:版本1.8

项目:版本1.7

 

解决方案:

要么修改电脑jdk,要么修改项目所依赖的jdk。

我选择把项目jdk改为1.8

(因为如果修改电脑的jdk我的其他项目可能就gg了)

 

先列一下我的myeclipse版本是2014blue

 

最初我是按这个方法下载jdk1.8的,链接,官方链接挂掉了,无法下载

所以只能手动安装了

 

1、由于电脑之前安装的是jdk1.8,所以首先找到jdk的安装目录,复制它

 

2、复制到myeclipse的安装目录下的binary文件夹下

 

3、myeclipse的Window->Preferences

 

 

 

4、在工程目录下

 

 

至此问题解决,Run

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!