Gradle failed to build

I’m having issues using gradle. I’m actually learning Java, so maybe i missed something in my setup…
But when i try to run

gradle init

I get this error:

FAILURE: Build failed with an exception.

* What went wrong:
Supplied javaHome must be a valid directory. You supplied: /nix/store/f0shs0j3nvd8dhiw6sh9mhyd9swlyalz-openjdk-8u272-b10/lib/openjdk

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

* Get more help at

I’ve also setup an environment var $JAVA_HOME…

Everything looks fine to me, the only issue I can think of is that the store path was garbage collected for some reason.

  1. Double check if that path exists
  2. Play around with suggested options and see if you can give us more information

Consider using newer JDK, it is expected to work fine with JDK8 but you are missing out on a bunch of features

upgrading gradle to unstable fix the issue… Probably some problems with the path