Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradlew and Java 9 in Cmd :FAILURE: Build failed with an exception

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine java version from '9.0.4'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

This is displayed when I'm running in the console (Cmd) :

gradlew setupDecompWorkspace

My gradlewrapper-properties are:

#Wed Jul 02 15:54:47 CDT 2014 
distributionBase=GRADLE_USER_HOME 
distributionPath=wrapper/dists 
zipStoreBase=GRADLE_USER_HOME 
zipStorePath=wrapper/dists 
distributionUrl=https\://services.gradle.org/distributions/gradle-2.0-bin.zip

The problem is clearly Java 9 but I do not know what to do to solve it. Install Java X.X.X or reinstall Java?

like image 696
Taupeman Avatar asked Dec 02 '25 06:12

Taupeman


1 Answers

You are using gradle 2.0, but support for Java 9 in gradle requires at least gradle 3, and the latest gradle version at the moment is 4.7.

Normally, you would be able to upgrade your gradle wrapper using

gradlew wrapper --gradle-version 4.7

But given your current version of the wrapper (2.0) doesn't support Java 9, this won't work.

As a workaround, you'll need to install gradle so you can use that to upgrade the wrapper. Follow the instructions on https://gradle.org/install/

Then - assuming gradle is configured on the PATH - use in the root of your project:

gradle wrapper --gradle-version 4.7

(notice the use of gradle not gradlew)

If gradle isn't on the PATH use

<path-to-your-gradle-install>\bin\gradle wrapper --gradle-version 4.7

Afterwards, you can consider to remove/uninstall the gradle installation again.

like image 135
Mark Rotteveel Avatar answered Dec 03 '25 22:12

Mark Rotteveel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!