Running 7.3 from Java 1.8 (52) with -testjar and -xmlpathinjar throws UnsupportedClassVersionError

Skip to first unread message

Bruce Ritter

Nov 14, 2022, 5:56:17 PM11/14/22
to testng-users
We are still running Java 1.8 for testing. When I try to run TestNG from a fat jar that includes the testng .xml profile files with -testjar and -xmlpathinjar I get:

Exception in thread "main" java.lang.UnsupportedClassVersionError: module-info 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(
        at Method)
        at java.lang.ClassLoader.loadClass(
        at sun.misc.Launcher$AppClassLoader.loadClass(
        at java.lang.ClassLoader.loadClass(
        at org.testng.internal.ClassHelper.forName(
        at org.testng.xml.XmlClass.loadClass(
        at org.testng.xml.XmlClass.init(
        at org.testng.xml.XmlClass.init(
        at org.testng.xml.XmlClass.<init>(
        at org.testng.xml.internal.XmlSuiteUtils.constructXmlClassesUsing(
        at org.testng.xml.internal.XmlSuiteUtils.newXmlSuiteUsing(
        at org.testng.JarFileUtils.extractSuitesFrom(
        at org.testng.TestNG.initializeSuitesAndJarFile(
        at org.testng.TestNG.initializeEverything(
        at org.testng.TestNG.privateMain(
        at org.testng.TestNG.main(

Everything appears to be 1.8, that is what is running locally (build and execution are running on the same machine), and all the Poms refer to 1.8 as the source and target versions.

Krishnan Mahadevan

Nov 14, 2022, 8:09:42 PM11/14/22
Please take a closer look at your dependencies. I think somewhere you are bringing in TestNG 7.6.1 which is what needs JDK11. 

Until 7.5 TestNG needs JDK8. 

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

From: <> on behalf of Bruce Ritter <>
Sent: Tuesday, November 15, 2022 4:26:17 AM
To: testng-users <>
Subject: [testng-users] Running 7.3 from Java 1.8 (52) with -testjar and -xmlpathinjar throws UnsupportedClassVersionError
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
To view this discussion on the web visit
Reply all
Reply to author
0 new messages