What java version is needed for JUnit 4.8

﹥>﹥吖頭↗ 提交于 2019-12-01 16:14:31

A spot check of a few classes shows that the JUnit 4.8.2 jar file was compiled with java 5, or with the java 6 compiler with the -target option set so that it makes java5-compatible class files.

A far more likelier explanation is that you've accidentally compiled the test you wanted to run with a Java 6 JDK. What does:

javap -verbose -classpath YOUR_TOP_DIRECTORY com.yourname.YourTest

say at the top of its output for "major version"? If it says 50, then the problem is that you've compiled your test class for java 6 only. You need to either use a JDK 5 compiler or pass the option -target 1.5 to your compiler.

The current .jar file for JUnit 4.8.2 was compiled with/for Java 5 (class version number is 49.0).

I remember an earlier version accidentally being built with Java 6 (and without the -target switch), but that was simply a mistake.

The pom.xml of Junit says jdk 1.5. http://github.com/KentBeck/junit/blob/master/pom.xml

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