0

I found my issue below when using this dependencies:

         </dependency>
        <dependency>
            <groupId>io.appium</groupId>
            <artifactId>java-client</artifactId>
            <version>7.6.0</version>
        </dependency>
  <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>7.5.0</version>
        </dependency>

        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-testng</artifactId>
            <version>7.8.1</version>
        </dependency>

the issue showing when I run the mvn clean test :

org/testng/annotations/Test 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


1 Answer 1

0

It's difficult to determine if this is specifically related to the dependencies mentioned.The error message text referenced in the question suggests that this is a Java version mismatch problem.

The Java Class File Disassembler tool can be used to inspect compiled Java class files. This can be useful for resolving java.lang.UnsupportedClassVersionError exceptions which may occur due to a mismatch between the version of Java used to compile a file and the current JRE version executing it.

Potential Approach to Fix

  1. Use the javap command to check the version of the Java runtime used to compile the file referenced in the exception.
javap -v org/testng/annotations/Test 

If you have grep installed you might find it easier to do something like the following.

javap -v org/testng/annotations/Test  | grep 'major version'
  1. Use this table from the Java Specification to find the Java version which corresponds to the major version number.

  2. Re-compile the files or install a compatabile JRE version to resolve.

Related Questions

More detailed discussions around this type of Java version compatibility issue can be found at the links below:

https://stackoverflow.com/questions/47457105/class-has-been-compiled-by-a-more-recent-version-of-the-java-environment

https://stackoverflow.com/questions/9170832/list-of-java-class-file-format-major-version-numbers

1
  • 1
    Thanks for the Answer Andre .. Finally I using another version of testNG which is version '<version>6.14.3</version>'. Dec 23, 2022 at 5:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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