UnsupportedClassVersionError ☕ Java

java.lang.UnsupportedClassVersionError: class file version 61.0, this version of the Java Runtime only recognizes up to 55.0

Code compiled for a newer Java version is running on an older JVM.

Seen on: Java Docker

Meaning

Class file versions map to Java releases: 52 = 8, 55 = 11, 61 = 17, 65 = 21. The runtime must be at least the compile target. Mismatched JAVA_HOME, Docker base images and IDE settings are the usual causes.

Common causes

  • App built with JDK 17/21 but run on Java 8/11
  • Dependency compiled for a newer Java (e.g. Spring Boot 3 requires 17)
  • Different JAVA_HOME for build and run
  • Old JRE base image in Docker

⚡ Quick fix

  1. Run on a JVM ≥ the class version (61 → Java 17)
  2. Or compile with --release 11 for older runtimes
  3. Update the Docker base image (eclipse-temurin:17-jre)

Detailed fix by platform

Java

  1. Set the compile target (Maven):
    xml
    <properties>
      <maven.compiler.release>17</maven.compiler.release>
    </properties>

How to diagnose

  1. Versions — Class version in the message → Java release
  2. Runtime — java -version where it runs
  3. Dependencies — Which library requires newer Java?

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.