Code Review Videos > How I Fixed > How I ‘Fixed’: Unsupported class file major version 64

How I ‘Fixed’: Unsupported class file major version 64

OK, not a true fix today. Not in the sense that I’d like, anyway.

The gist of this is that I was trying to follow along with the JetBrains official Introduction to Coroutines and Channels tutorial. I cloned the GitHub repo, and opened in IntelliJ.

When the dependencies were downloaded via Gradle, I got the following error:

Unsupported class file major version 64Code language: JavaScript (javascript)

Which wasn’t that helpful.

On another tab I found a lot more info, mainly things like this:

Caused by: BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 64
	at org.gradle.groovy.scripts.internal.DefaultScriptCompilationHandler.compileScript(
	at org.gradle.groovy.scripts.internal.DefaultScriptCompilationHandler.compileToDir(
	at org.gradle.groovy.scripts.internal.BuildOperationBackedScriptCompilationHandler$
	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(
	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(
	at org.gradle.groovy.scripts.internal.BuildOperationBackedScriptCompilationHandler.compileToDir(
	at org.gradle.groovy.scripts.internal.FileCacheBackedScriptClassCompiler$CompileToCrossBuildCacheAction.execute(
	at org.gradle.groovy.scripts.internal.FileCacheBackedScriptClassCompiler$CompileToCrossBuildCacheAction.execute(
	at org.gradle.groovy.scripts.internal.FileCacheBackedScriptClassCompiler$ProgressReportingInitializer.execute(
	at org.gradle.groovy.scripts.internal.FileCacheBackedScriptClassCompiler$ProgressReportingInitializer.execute(
	at org.gradle.cache.internal.DefaultPersistentDirectoryCache$Initializer.initialize(
	at org.gradle.cache.internal.FixedSharedModeCrossProcessCacheAccess$
	at org.gradle.cache.internal.DefaultFileLockManager$DefaultFileLock.doWriteAction(
	at org.gradle.cache.internal.DefaultFileLockManager$DefaultFileLock.writeFile(
	... 166 more
Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 64
	at groovyjarjarasm.asm.ClassReader.<init>(
	at groovyjarjarasm.asm.ClassReader.<init>(
	at groovyjarjarasm.asm.ClassReader.<init>(
	at groovyjarjarasm.asm.ClassReader.<init>(
	at org.gradle.groovy.scripts.internal.GradleResolveVisitor.resolveFromResolver(
	at org.gradle.groovy.scripts.internal.GradleResolveVisitor.resolve(
	at org.gradle.groovy.scripts.internal.GradleResolveVisitor.visitClass(
	at org.gradle.groovy.scripts.internal.GradleResolveVisitor.startResolving(
	... 189 moreCode language: HTML, XML (xml)

Which, whilst pretty wild, was helpful enough to point me at the word “gradle”, which as newb who has struggled with Java a lot lately, knew that meant something to do with the build system.

One thing that dawned on me was that I’d upgraded to Java version 20 over the weekend.

Could that be the cause?

Well, a quick look at the command line left me a little perplexed:

java 20 missing gradle

Does Gradle need to be installed on top of a new Java version?

I’m not sure.

Fortunately SDK Man can solve this:

sdk install gradle

But that didn’t solve the issue in IntelliJ.

The Solution

What worked for me was downgrading to Java 19.

That’s why I put the fixed part of the post title in inverted commas. I don’t consider this a true fix. To me, going forward a major version of a runtime shouldn’t break things that previously worked.

For clarity though, here’s exactly how I fixed it – for fellow Java / Kotlin newbs.

Using sdk manager I ran the command:

sdk list javaCode language: PHP (php)

This spits out a very large list, and to me, this wasn’t very intuitive the first few times I used it.

The sdk manager manages more than just Java. For example, earlier on I used it to sdk install gradle.

When you list out all the Java versions, you get something like this:

sdk man list java

What you need is the ‘thing’ you are installing (Java), and the specific version – or identifier. That’s the one on the right hand column.

I therefore ran:

sdk install java 19.0.2-openCode language: CSS (css)

Which gives:

sdk install java 19.0.2-open

I even include my screw ups in the screenshots 🙂

OK, once Java 19 is on, re-open the project.

You now need to switch from Java 20 to Java 19:

set java version in intellij idea

Then download all the correct stuff for that version of Java, for this specific project.

To do that, open the Gradle tab:

intellij idea gradle tab

And then reload the Gradle project. Note, this may make your fans spin:

intellij idea reload gradle project

From there, you should be able to load your project.

Fun times this Java lark.

4 thoughts on “How I ‘Fixed’: Unsupported class file major version 64”

  1. thank you this method definitely works I just this to make Spring Boot 3.0.6 work on Java 17

  2. what is ‘sdk’ is that ./cmdline-tools/bin/sdkmanager if yes, that doesn’t have a “list” command it has “–list” but then it doesn’t have any java versions. I usually have to install java separately. (I am on MacOS)

    • Is sdkmanager for Android?

      I’m not sure – I think there is confusion here.

      I’m using

      sdk man has a command sdk list

      I have no experience with Android so am not sure what the problem might be.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.