What this thread does
Unsupported class file major version 65 A build-time reader encounters Java 21 bytecode that its current parser cannot handle. Do first: run ./gradlew --version, then repeat the failing task with --stacktrace to distinguish build-script compilation from a plugin's bytecode transformation. Gradle CLI. Evidence: Gradle's release notes establish Java 21 runtime support, while two public reports locate this message in different parsers; neither report makes every major-version error a wrapper defect. Not for: a full Gradle 9 migration; see gradle-8-to-9-8-2-upgrade-jdk-kotlin-dsl-configuration-cache.
Diagnostic: Unsupported class file major version 65
As of November 2026, the version boundaries here are Gradle 8.5 for running on Java 21, Gradle 8.14 as the concrete newer-wrapper example, and Shadow 8.3.0 for Java 21 parsing support. These are compatibility boundaries, not latest-version claims.
1. An older wrapper runs on Java 21 and fails while compiling build scripts. Gradle 8.4 supported Java 21 toolchains but not running Gradle itself on Java 21; 8.5 added that support. See 8.5's full Java 21 support. If the project's plugins permit 8.14, run ./gradlew wrapper --gradle-version=8.14 under a JDK supported by the old wrapper, then repeat the wrapper command as the 8.14 release instructions specify. Confirm ./gradlew --version reports the intended Gradle/JVM pair, then rerun the failed task. If plugins require the old wrapper, retain its compatible daemon JDK and use an appropriate toolchain for compilation instead of forcing Java 21 onto the daemon.
2. Gradle 8.14 is intended, but the launch path selects a different installation or daemon JDK. Use the project's ./gradlew entry point. Inspect org.gradle.java.home in the applicable Gradle properties and the IDE's Gradle JVM selection; a compiler toolchain does not by itself choose the daemon. Set the daemon to an installed JDK compatible with the wrapper and plugins. Gradle build environment documents the distinction. Compare the IDE build's Gradle/JVM values with the terminal invocation and rerun the actual failing task. If they already agree, follow the parser frame rather than changing Java again.
3. The trace enters ShadowCopyAction and ASM during relocation with Shadow 8.1.1. For this branch, the reader is inside Shadow. Shadow 8.3.0 added Java 21 support, requires Gradle 8.3 or later, and changed the plugin ID. The dated 8.3.0 changelog gives those boundaries. A compatible Kotlin DSL build can replace the old application with id("com.gradleup.shadow") version "8.3.0" in its plugins block; choose a newer compatible version if the project requires it. Rerun the same shadowJar task with relocation enabled and exercise the generated application artifact. A successful ordinary jar task does not exercise the failing relocation path.
Evidence and limits
In Gradle #27665, 11 January 2024, jrgleason reports this error in a Gradle 8.1.1 build-script cache path. In Shadow #911, 11 March 2024, str8y reports Shadow 8.1.1, Gradle 8.3 and Java 17, with the exception inside ASM during relocation. The second report is evidence that changing the daemon JDK alone need not repair a plugin parser. Shadow's 8.3.0 support entry is dated 8 August 2024.
This case covers build-time parser failures. Java's UnsupportedClassVersionError while launching the application is a separate runtime compatibility failure. Changing source compatibility cannot rewrite a third-party JAR already present on the build path. Plugin-specific compatibility constraints still apply before any wrapper change.
Started from a post by @Gradle, packaged by the editor. Original post