2

My testing framework is built with Cucumber, TestNG, Java 1.8 and Maven

I recently updated my IntelliJ IDE

Details: IDE : IntelliJ IDEA Ultimate 2020.3 - Runtime version : 11.0.9

Cucumber is integrated with testNg.

While trying to execute a scenario in a cucumber feature, I'm getting this following error. But I don't get this error when I run the cucumber feature with a TestRunner

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/jetbrains/plugins/cucumber/java/run/CucumberJvm4SMFormatter has been compiled by a more recent version of the Java Runtime (class file version 55.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(ClassLoader.java:756)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
    at cucumber.runtime.formatter.PluginFactory.loadClass(PluginFactory.java:173)
    at cucumber.runtime.formatter.PluginFactory.pluginClass(PluginFactory.java:165)
    at cucumber.runtime.formatter.PluginFactory.getPluginClass(PluginFactory.java:222)
    at cucumber.runtime.formatter.PluginFactory.isStepDefinitionReporterName(PluginFactory.java:205)
    at cucumber.runtime.RuntimeOptions$ParsedPluginData.addPluginName(RuntimeOptions.java:357)
    at cucumber.runtime.RuntimeOptions.parse(RuntimeOptions.java:159)
    at cucumber.runtime.RuntimeOptions.<init>(RuntimeOptions.java:90)
    at cucumber.runtime.RuntimeOptions.<init>(RuntimeOptions.java:85)
    at cucumber.runtime.Runtime$Builder.withArgs(Runtime.java:133)
    at cucumber.runtime.Runtime$Builder.withArgs(Runtime.java:129)
    at cucumber.api.cli.Main.run(Main.java:22)
    at cucumber.api.cli.Main.main(Main.java:8)

This is my TestRunner:

@CucumberOptions(features = "classpath:features/Batch.feature", glue = { "" },
plugin = { "com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:", "html:docs/"},monochrome = true)

public class RunCucumberTest extends AbstractTestNGCucumberTests {
    
    @Override
    @DataProvider(parallel=false)
    public Object[][] scenarios() {
        return super.scenarios();
    }

}

I don't see this error with other applications running on IntelliJ IDE. Is this related with Cucumber?

Please help me how to fix this.

1
  • i got the same error. I didn't change anything.. so why should i update to java 11? I want to continue working with java 8 Feb 21 at 11:48
1

You are using java jdk 8 ,

You should update it to jdk 11+

https://stackoverflow.com/q/9170832/6793637

0

I had the same error using IntelliJ IDEA Ultimate 2020.3 running cucumber tests, the only way to make IntelliJ IDEA work was to move from version 2020.3 to 2020.2.4 version

You have to have in mind that this are the major version number of the class file format being used.

Java SE 17 = 61 (0x3D hex),
Java SE 16 = 60 (0x3C hex),
Java SE 15 = 59 (0x3B hex),
Java SE 14 = 58 (0x3A hex),
Java SE 13 = 57 (0x39 hex),
Java SE 12 = 56 (0x38 hex),
Java SE 11 = 55 (0x37 hex),
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).

And IntelliJ 20.3 uses Java Runtime (class file version 55.0) to compile CucumberJvm4SMFormatter

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.