Skip to content
Advertisement

How to fix Gradle not recognizing Java 10 on Linux?

When working with the latest Gradle version with Java 10 on Linux, it fails to identify version number of Java as 10 as valid Java version. How to fix this problem on Linux machines ? Log details of the error here

And here is the complete error report (N.B. Running gradle --version or gradle -v also gives the same output :

JavaScript

EDIT : Output of gradle --stacktrace

JavaScript

Output of java –version

JavaScript

Advertisement

Answer

You need to upgrade Gradle. Version 4.5.1 and later definitely support Java 10.

If you think you have 4.5.1 or later installed, but gradle -version still won’t run, it’s possible that when you type gradle at the command line, it’s still running an older version for some reason.

One common thing to do is alias gradle to ./gradlew, so that in the context of a Gradle project, you’ll use the wrapper Gradle rather than the system Gradle. This is usually helpful, but in a situation like this, it backfires. You should be able to determine the installed system Gradle with which:

JavaScript

(I’ve elided some warnings about illegal reflective access, if you get those, don’t worry about them.)

If $(which gradle) -version still won’t run, you need to upgrade the system gradle. But if it does, to update the Gradle wrapper, you can edit your build.gradle

JavaScript

— and then use the system Gradle to rerun the wrapper task:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement