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.
Using 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.
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.