javaspringkotlingradlespring-initializr

Spring initializr project results in Unsupported class file major version 64


When I create a new project using the Spring initializr Gradle won't build the project. I use IntelliJ IDEA.

The error message is

* Exception is:
org.gradle.cache.CacheOpenException: Could not open init generic class cache for initialization script '/tmp/ijmapper.gradle' (/home/julius/.gradle/caches/7.6.1/scripts/dnnmnny7cynyzgkf00s30jlld).
    at org.gradle.cache.internal.DefaultPersistentDirectoryStore.open(DefaultPersistentDirectoryStore.java:91)
    ... 166+ more
Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 64

I looked it up using this table, it's java 20. The issue is, that I didn't select Java-20, I chose Java-17. On top of that, I'm not able to install Java-20 on my Linux machine yet.


Solution

  • I've found the problem: My Gradle settings were trying to use Java 20. I solved it by clicking on Gradle -> the little cogwheel -> Gradle Settings and setting Gradle JVM to 17.