Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

org/testng/ITestListener has been compiled by a more recent version of the Java Runtime (class file version 55.0), only recognizes version up to 52

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.

How can I resolve this?

like image 367
Jawad Karim Avatar asked Oct 29 '25 05:10

Jawad Karim


2 Answers

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 installed TestNG via the Eclipse Marketplace, check out this answer.

  4. 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.

like image 121
Stephen C Avatar answered Oct 31 '25 11:10

Stephen C


I got same issue, tried some ways, but the following things worked for me.

Here actual issue is with TestNG plugin "java.lang.UnsupportedClassVersionError: org/testng/remote/RemoteTestNG"

Here I added testNG plugin from Market place then It was installed 7.8.0 version which was developed by using java 8+ I think, due that it even we used java 1.8(8) also showing that error.

Solution: Using following url copy 7.4.0 site and add using the following steps https://testng.org/testng-eclipse-update-site/

  1. Uninstall current TestNG plugin(7.8.0)
  2. In eclipse -> Help-> Install new software-> Add -> Add repository-> name: TestNG7.4.0 location: https://testng.org/testng-eclipse-update-site/7.4.0 continue installation. Thanks, Samba M
like image 25
SambaM Avatar answered Oct 31 '25 11:10

SambaM