I’m completely new to Gradle. I tried to search the docs and the forum but unfortunately I didn’t find a solution. So I’ll ask here.
I’m trying to compile a project that I cloned and get this error:
Cause: org/openjfx/gradle/JavaFXPlugin has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 54.0
My Java home and org.gradle.java.home is both set to Java 17. I believe the problem is with sourceCompatibility setting but I can’t figure out how to set this property.
sourceCompatibility = 17 in build.gradle gives me this error:
Caused by: groovy.lang.MissingPropertyException: Could not set unknown property ‘sourceCompatibility’ for root project
class file version 55 is Java 11, 54 is Java 10.
So the error is saying that you use Java 10 to execute a Gradle build where a version of the JavaFXPlugin is applied that needs at least Java 11 to run.
Setting any source compatibility or similar will not help you at all.
If you run
./gradlew --help it will display which Java version is used and it is most likely a Java 10 version.
Maybe you have
JAVA_HOME set to a Java 10 path.
Thanks for replying.
./gradlew --version told me this:
Build time: 2022-02-08 09:58:38 UTC
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 17.0.1 (Eclipse Adoptium 17.0.1+12)
OS: Windows 10 10.0 amd64
I also double-checked that
JAVA_HOME is set to my Java 17 JDK path.
I’m using IntelliJ IDEA btw if that makes any difference.
Of course it does.
If you check with
./gradlew --version then it is only meaningful for running your build also from commandline.
When you run Gradle from IDE, you have to check what you configured in the IDE to run Gradle with in the settings dialog, or by running
gradle --version from the IDE.
Ah, should have thought of that. But I didn’t expect that setting there as Maven get the JDK from the project pom.
Now it works. Thanks!