java.lang.UnsupportedClassVersionError seen while adding a custom jar for DevTest 10.7.2
search cancel

java.lang.UnsupportedClassVersionError seen while adding a custom jar for DevTest 10.7.2

book

Article ID: 367580

calendar_today

Updated On:

Products

CA Application Test

Issue/Introduction

While trying to add a customer jar, which was developed using Java 20+, we are seeing the following error:

java.lang.UnsupportedClassVersionError: <path/file> has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0.

Environment

Service Virtualization 10.7.2

Cause

Service Virtualization 10.7.2 supports Java 8, see the Service Virtualization Release Notes - Third Party Acknowledgements:

  • OpenJDK ORB 8.1.4.Final : GNU General Public License v2.0 w/Classpath exception
  • OpenJDK ORB 8.1.5.Final : GNU General Public License v2.0 w/Classpath exception

The error that you are seeing means that a Java version mismatch has been detected.

java.lang.UnsupportedClassVersionError: <path/file> has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0.

According to Oracle's Java documentation, your custom jar was complied under Java JDK 17 (Major version 61), and the DevTest JRE only supports class versions up to release 52 (Java 8). See Java Class File Format

Resolution

In order to run the custom jar, the jar needs to be compiled using the JDK 8, as JDK 17 is not supported.