How to Install Gradle

Gradle is a dependency management / build tool that combines the best of Maven and Ant, making it an extremely powerful and customizable tool. It also uses a sleek Groovy DSL instead of the XML approach of Maven and Ant and is my personal tool-of-choice when I start a new project. Here’s how to install. I have some links to other gradle tutorials at the bottom of this post.

1. Install Java

First you need to have the Java JDK (Java Development Kit) installed; having the JRE (Java Runtime Environment) is not enough. To check if you have the JDK installed, open a command prompt or terminal and type javac -version. If you have a JDK installed, you will see your javac version output, eg. javac 1.7.0_01. If you get an error that javac is not a recognized command, download and install the Java JDK.

2. Download Gradle

Download from Gradle site

3. Unpack and Set System variables
  1. Unzip the Gradle download to the folder to which you would like to install Gradle, eg. “C:\Program Files”. The subdirectory gradle-x.x will be created from the archive, where x.x is the version.
  2. Add location of your Gradle “bin” folder to your path. Open the system properties (WinKey + Pause), select the “Advanced” tab, and the “Environment Variables” button, then add “C:\Program Files\gradle-x.x\bin” (or wherever you unzipped Gradle) to the end of your “Path” variable under System Properties. Be sure to omit any quotation marks around the path even if it contains spaces. Also make sure you separated from previous PATH entries with a semicolon “;”.
  3. In the same dialog, make sure that JAVA_HOME exists in your user variables or in the system variables and it is set to the location of your JDK, e.g. C:\Program Files\Java\jdk1.7.0_06 and that %JAVA_HOME%\bin is in your Path environment variable.
  4. Open a new command prompt (type cmd in Start menu) and run gradle –version to verify that it is correctly installed.
  1. Extract the distribution archive, i.e. gradle-x.x-bin.tar.gz to the directory you wish to install Gradle. These instructions assume you chose /usr/local/gradle. The subdirectory gradle-x.x will be created from the archive.
  2. In a command terminal, add Gradle to your PATH variable: export PATH=/usr/local/gradle/gradle-x.x/bin:$PATH
  3. Make sure that JAVA_HOME is set to the location of your JDK, e.g. export JAVA_HOME=/usr/java/jdk1.7.0_06 and that $JAVA_HOME/bin is in your PATH environment variable.
  4. Run gradle –version to verify that it is correctly installed.

You now have Gradle set up! Check out our post on how to build a simple Java web application using Gradle. I have several other Gradle tutorials available.

More reading:

Gradle – Installation Instructions
Gradle – Users Guide
Tagged with: , ,
Posted in Gradle
  • Igor


    I am trying to install gradle on openSuse. I followed the instructions, unzip, added bin folder to path, but when I run gradle I get:

    :~> gradle

    FAILURE: Build aborted because of an internal error.

    * What went wrong:

    Build aborted because of an unexpected internal error. Please file an issue at:

    * Try:

    Run with –debug option to get additional debug info.

    * Exception is:

    net.rubygrapefruit.platform.NativeException: Could not open terminal for stdout: could not get termcap entry

    at net.rubygrapefruit.platform.internal.TerminfoTerminal.init(

    at net.rubygrapefruit.platform.internal.WrapperTerminal.init(

    at net.rubygrapefruit.platform.internal.AbstractTerminals.getTerminal(

    at org.gradle.internal.nativeplatform.console.NativePlatformConsoleDetector.getConsole(

    at org.gradle.logging.internal.ConsoleConfigureAction.execute(

    at org.gradle.logging.internal.ConsoleConfigureAction.execute(

    at org.gradle.logging.internal.OutputEventRenderer.attachConsole(

    at org.gradle.logging.internal.DefaultLoggingManager.attachConsole(

    at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(

    at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(

    at org.gradle.launcher.cli.ExceptionReportingAction.execute(

    at org.gradle.launcher.cli.ExceptionReportingAction.execute(

    at org.gradle.launcher.Main.doAction(


    at org.gradle.launcher.Main.main(

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke(

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(

    at java.lang.reflect.Method.invoke(

    at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(


    at org.gradle.launcher.GradleMain.main(

    Any advice?

  • Andrew J

    Where is my local folder on mac?! ps i run mavericks

  • jagdish


    After setup of gradle , iam coming accross the below error,would be helpful if any solution on this.

    FAILURE: Build failed with an exception.

    * What went wrong:


Follow Me
RSS FeedFollow me on Twitter