和老师一样的代码,为什么会有这样的错误?

和老师一样的代码,为什么会有这样的错误?

http://img1.sycdn.imooc.com//climg/5d37fd320001576e12780819.jpg

"C:\Program Files (x86)\Java\jdk1.7.0_60\bin\java.exe" -ea -Didea.test.cyclic.buffer.size=1048576 "-javaagent:D:\IntelliJ IDEA 2018.2.4\lib\idea_rt.jar=56084:D:\IntelliJ IDEA 2018.2.4\bin" -Dfile.encoding=UTF-8 -classpath "D:\IntelliJ IDEA 2018.2.4\lib\idea_rt.jar;D:\IntelliJ IDEA 2018.2.4\plugins\junit\lib\junit-rt.jar;D:\IntelliJ IDEA 2018.2.4\plugins\junit\lib\junit5-rt.jar;C:\Program Files (x86)\Java\jdk1.7.0_60\jre\lib\charsets.jar;C:\Program Files (x86)\Java\jdk1.7.0_60\jre\lib\deploy.jar;C:\Program Files (x86)\Java\jdk1.7.0_60\jre\lib\ext\access-bridge-32.jar;C:\Program Files (x86)\Java\jdk1.7.0_60\jre\lib\ext\dnsns.jar;C:\Program Files (x86)\Java\jdk1.7.0_60\jre\lib\ext\jaccess.jar;C:\Program Files (x86)\Java\jdk1.7.0_60\jre\lib\ext\localedata.jar;C:\Program Files (x86)\Java\jdk1.7.0_60\jre\lib\ext\sunec.jar;C:\Program Files (x86)\Java\jdk1.7.0_60\jre\lib\ext\sunjce_provider.jar;C:\Program Files (x86)\Java\jdk1.7.0_60\jre\lib\ext\sunmscapi.jar;C:\Program Files (x86)\Java\jdk1.7.0_60\jre\lib\ext\sunpkcs11.jar;C:\Program Files (x86)\Java\jdk1.7.0_60\jre\lib\ext\zipfs.jar;C:\Program Files (x86)\Java\jdk1.7.0_60\jre\lib\javaws.jar;C:\Program Files (x86)\Java\jdk1.7.0_60\jre\lib\jce.jar;C:\Program Files (x86)\Java\jdk1.7.0_60\jre\lib\jfr.jar;C:\Program Files (x86)\Java\jdk1.7.0_60\jre\lib\jfxrt.jar;C:\Program Files (x86)\Java\jdk1.7.0_60\jre\lib\jsse.jar;C:\Program Files (x86)\Java\jdk1.7.0_60\jre\lib\management-agent.jar;C:\Program Files (x86)\Java\jdk1.7.0_60\jre\lib\plugin.jar;C:\Program Files (x86)\Java\jdk1.7.0_60\jre\lib\resources.jar;C:\Program Files (x86)\Java\jdk1.7.0_60\jre\lib\rt.jar;D:\mybatis-demo1\target\test-classes;D:\mybatis-demo1\target\classes;C:\Users\86159\.m2\repository\com\mchange\c3p0\0.9.5.4\c3p0-0.9.5.4.jar;C:\Users\86159\.m2\repository\com\mchange\mchange-commons-java\0.2.15\mchange-commons-java-0.2.15.jar;C:\Users\86159\.m2\repository\mysql\mysql-connector-java\5.1.41\mysql-connector-java-5.1.41.jar;C:\Users\86159\.m2\repository\org\mybatis\mybatis\3.4.3\mybatis-3.4.3.jar;C:\Users\86159\.m2\repository\junit\junit\4.12\junit-4.12.jar;C:\Users\86159\.m2\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar" com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit4 TestDemo,test


java.lang.UnsupportedClassVersionError: org/apache/ibatis/builder/xml/XMLIncludeTransformer : 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 org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLStatementBuilder.java:87)

at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(XMLMapperBuilder.java:135)

at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(XMLMapperBuilder.java:128)

at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:118)

at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:92)

at org.apache.ibatis.builder.xml.XMLConfigBuilder.mapperElement(XMLConfigBuilder.java:369)

at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:118)

at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:98)

at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:78)

at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:64)

at TestDemo.test(TestDemo.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:50)

at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)

at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)

at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)

at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)

at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)

at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)

at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)

at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)

at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)

at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)

at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)

at org.junit.runners.ParentRunner.run(ParentRunner.java:363)

at org.junit.runner.JUnitCore.run(JUnitCore.java:137)

at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)

at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)

at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)

at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)


正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

2回答
吃吃吃鱼的猫 2019-07-24 17:54:03

同学你好,问一下同学的jdk版本是多少呢?

jdk版本不一致会出现以下报错,建议同学将jdk换为与视频中相同的jdk1.8。

如果我的回答解决了你的疑惑,请采纳。祝:学习愉快~

吃吃吃鱼的猫 2019-07-24 15:19:52

同学你好,Resources类导错包了~

http://img1.sycdn.imooc.com//climg/5d38068d0001b00c04370051.jpg

应该导入以下包:

http://img1.sycdn.imooc.com//climg/5d38065b0001396504360040.jpg

如果我的回答解决了你的疑惑,请采纳。祝:学习愉快~

  • 提问者 慕丘 #1
    改完之后还是报同样的错误,我导入课程配套的源代码运行之后也是报同样的错误
    2019-07-24 16:02:09
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师