This article will show you how to install Gradle on Ubuntu 16.04(Xenial Xerus). There are 2 approaches to install Gradle on Ubuntu.
- Install manually
- Install with SDKMAN
We will try both approaches in this tutorial.

Gradle
1. Install Gradle on Ubuntu 16.04 Manually
1.1. Prerequisites
Gradle requires Java 7 or new version. You can check by issue command:
1 |
java -version |
1.2. Download Gradle
You can download Gradle distribution from the Gradle website. Currently, the latest release of Gradle is version 3.0.
In the following command, I will download the binary only version of Gradle:
1 |
wget https://services.gradle.org/distributions/gradle-3.0-bin.zip |
1.3. Unpack Gradle
1 |
sudo unzip gradle-3.0-bin.zip -d /usr/local |
This command will unpack the Gradle distribution to /usr/local/gradle-3.0. Note that we need unzip package to run the command. If there is no unzip on your machine, you can install it by typing:
1 |
sudo apt install unzip |
Next, we will create a shortcut to that Gradle distribution:
1 2 |
cd /usr/local sudo ln -s gradle-3.0 gradle |
1.4. Create GRADLE_HOME Environment Variables.
Create a gradle.sh file at /etc/profile.d folder (you can use vi with below command)
1 |
sudo vi /etc/profile.d/gradle.sh |
Enter the follow content to the file:
1 2 |
export GRADLE_HOME=/usr/local/gradle export PATH=${GRADLE_HOME}/bin:${PATH} |
Save the file.
We will need to activate the above environment variables. We can do that by log out and log in again or simply run below command:
1 |
source /etc/profile |
1.5. Verify
To check if Gradle is properly installed, we just need type:
1 |
gradle -v |
2. Install Gradle on Ubuntu 16.04 With SDKMAN
SDKMAN is a tool for managing parallel versions of multiple Software Development Kits on most Unix based systems. We can leverage SDKMAN to install Gradle on Ubuntu 16.04
2.1. Install SDKMAN
2.1.1. Open terminal and enter
1 |
curl -s "https://get.sdkman.io" | bash |
Note that, SDKMAN may ask you to install unzip package as the following:
1 2 3 4 5 6 7 8 |
Looking for a previous installation of SDKMAN... Looking for unzip... Not found. ======================================================================================== Please install unzip on your system using your favourite package manager. Restart after installing unzip. ======================================================================================== |
In that case, you simply need to install unzip by issuing command:
1 |
sudo apt install unzip |
2.1.2. Enter the following code snippet on the terminal
1 |
source "$HOME/.sdkman/bin/sdkman-init.sh" |
2.1.3. Lastly, verify that installation succeeded
1 |
sdk version |
The output will be similar to:
1 2 3 4 5 6 |
==== BROADCAST ============================================================ * 21/08/16: Asciidoctorj 1.5.4.1 released on SDKMAN! #asciidoctorj * 15/08/16: Gradle 3.0 released on SDKMAN! #gradle * 08/08/16: Gradle 3.0-rc-2 released on SDKMAN! #gradle =========================================================================== SDKMAN 5.0.0+51 |
2.2. Install Gradle By SDKMAN
1 |
sdk install gradle 3.0 |
2.3. Verify
To check if Gradle is properly installed, you can run the command:
1 |
gradle -v |
3. Summary
We have just tried to install Gradle on Ubuntu 16.04 LTS (Xenial Xerus). There are 2 installation approaches for you to select. Both of them are simple. However, the second one seems to be more simple and be easier to switch between different version of Gradle. If you’re looking for other articles about Gradle or Maven installation guide, you can refer to my recent posts:
Install Maven on Ubuntu 16.04 LTS (Xenial Xerus)
Where is Gradle Cache Location
Using Gradlew, The Gradle Wrapper
Extremely helpful! Thank you so much!