Home > database >  org/testng/ITestListener has been compiled by a more recent version of the Java Runtime (class file
org/testng/ITestListener has been compiled by a more recent version of the Java Runtime (class file

Time:07-22

When I execute my test with testng.xml then it runs fine. but when I execute with pom.xml then got the ERROR.. [ERROR] java.lang.UnsupportedClassVersionError: org/testng/ITestListener 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

my Java version: 1.8.0_333, and Apache Maven 3.8.4.

if any one knows the solution please help me.

CodePudding user response:

If any one knows the solution please help me.

As noted in the comments, the TestNG website says:

Requirements

TestNG Upto v7.5: JDK 8 or higher.

TestNG v7.6.0 and above: JDK 11 or higher.

So the possible solutions are:

  1. Use an older version of TestNG than v7.6.0 if you want to use Java 8 as your development platform. The TestNG version will probably be in your project's POM file.

  2. Upgrade your development platform to Java 11 or later.

  3. If you are feeling brave1, attempt to backport the version of TestNG (>= v7.6.0) that you are using to run on Java 8 (or older).


1 - This could be trivial or complicated. You won't know until you try it.

  • Related