TestNG Eclipse plugin v7.8 issue: UnsupportedClassVersionError (compiled at class version 55 [Java 11])

4,114 views
Skip to first unread message

Nikodaemus

unread,
Jun 27, 2023, 3:42:19 AM6/27/23
to testng-users
Hello. I recently upgraded to TestNG 7.8 for my Eclipse installation, where I develop in Java 8. When I tried to run a test class, I got two error dialogs from the JVM launcher, and the following stack trace in Eclipse:

Dialog 1
"Error: A JNI error has occurred, please check your installation and try again."

Dialog 2
"A Java Exception has occurred."

In the Eclipse console:

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/testng/remote/RemoteTestNG 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:473)

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:352)

at java.lang.ClassLoader.loadClass(ClassLoader.java:351)

at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:621)



I was able to work around this by:
  • Installing a Java 11 JRE on my system
  • Creating an entry in Eclipse at Java -> Installed JREs to reference this new JRE
  • Setting the Java -> Compiler -> Compiler compliance level to 11
    • This proved to be unnecessary after further analysis, but seems like a good idea for consistency.
  • In the project Properties -> Java Build Path page -> Libraries tab, updating the JRE System Library entry to the Java 11 execution environment
...is this really all necessary? It feels a little odd to need a Java 11 JRE just to run tests for a Java 8 project, though perhaps the new TestNG has features specific to Java 11.

Thank you,

Niko

Paul King

unread,
Jun 27, 2023, 5:10:49 AM6/27/23
to testng...@googlegroups.com
You might want to try 7.7.1, that is the latest JDK8 supported version.


Virus-free.www.avast.com

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/testng-users/dd0ad844-97f4-4ee2-a9ae-3289da79da96n%40googlegroups.com.

⇜Krishnan Mahadevan⇝

unread,
Jun 27, 2023, 6:17:07 AM6/27/23
to testng...@googlegroups.com
  • 7.5.1 - Last version that supports JDK8
  • 7.8.0 - Latest version that needs JDK11

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribblings @ https://rationaleemotions.com/


Bruce Ritter

unread,
Jul 11, 2023, 11:41:25 PM7/11/23
to testng-users
Be sure that the correct Java version compatible version of TestNG plugin in Eclipse is installed as well as the version in your POM. I found that when I updated my Eclipse, it also updated the plugin, which was NOT Java 8 compatible. I had to uninstall the TestNG plugin and reinstall a Java 8 compatible version.

Aliasger Kiranawala

unread,
Sep 7, 2023, 9:08:36 AM9/7/23
to testng-users
One solution which worked for me is :
Right click on project > Build Path > Configure > Library and remove TESTNG from there. 
It will support TESTNG configured in pom file and will allow to execute.

Reply all
Reply to author
Forward
0 new messages