Issues with Gradle on Windows 10


I’m having a bit of a hardtime installing Gradle on my Windows 10 laptop.

  1. I’ve unziped the Gradle 4.2.1 zip to ‘C:\Gradle’

  2. I’ve added the C:\Gradle\gradle-4.2.1\bin to my System’s Path environment variable

  3. I’ve checked that my javaw.exe and java.exe are at my %JAVA_HOME%\bin\ (%JAVA_HOME% points to where I’ve installed my JDK)

  4. I’ve run the command ‘gradle -v’ to check if it is working

  5. I get prompted with an error:

    C:\Windows\System32>gradle -v

    ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files\Java\jdk1.8.0_131;

    Please set the JAVA_HOME variable in your environment to match the
    location of your Java installation.

I’ve solved this by running ‘gradle.bat’ - it seems this was a necessary step for installing/setting-up gradle that wasn’t mentioned in the page.

I suggest that running the gradle.bat should be included in the instructions for gradle installation in Windows’ Systems.

That gradle.bat execution is only mentioned under section 'Upgrade with the Gradle Wrapper