javaeclipsejunitunsupported-class-version

Unsupported major.minor version 52.0 for when running junit


I'm using eclipse to run my tests with: right click test method -> Run As -> JUnit Test. This results in the following error:

java.lang.UnsupportedClassVersionError: com/bazaarvoice/jolt/JsonUtils : Unsupported major.minor version 52.0

However, when running the following command, I do not run into this issue

mvn -Dtest=MyTestClass#myTestMethod test

I tried running and compiling using the same version of java (1.8) following this answer, but I'm still getting this major.minor error.

Is there some specific java version that I need to set up for junit that I'm missing?


Solution

  • So I seem to have "solved" the problem by right clicking my project -> Properties -> Java Compiler -> Execution Environments -> JavaSE-1.7 (under Execution Environments) -> selected Java SE 8 under Compatible JREs

    I got to Execution Environments via a hyperlink from a warning message at the bottom of the Java Compiler section which said:

    When selecting 1.8 compliance, make sure to have a compatible JRE installed and activated (currently 1.7). Configure the 'Installed JREs' and 'Execution Environments', or change the JRE on the 'Java Build Path'

    I don't know what the regular route to Execution Environments option is, and I don't know why that seemed to have solved by issue, but I'm not running into the major.minor version error anymore.