How to Install Gradle on MXLinux Latest

Gradle is an open-source build automation tool widely used in the Java ecosystem. In this tutorial, we will guide you through the process of installing Gradle on MXLinux Latest.

Prerequisites

To follow this tutorial, you will need:

Step 1: Update the system

Before installing Gradle, it's always recommended to update the system packages to their latest versions. Run the following command in the terminal to update the system:

sudo apt update && sudo apt upgrade -y

Step 2: Install Java

Gradle requires Java Runtime Environment (JRE) or Java Development Kit (JDK) to run. Verify if the system has already installed Java by running the following command:

java -version

If the output shows the Java version, you can skip this step. If not, install OpenJDK 11 using the following command:

sudo apt install -y openjdk-11-jdk

After installation, verify the version of Java using the same command as before.

Step 3: Download Gradle

Go to the Gradle download page and select the latest version of Gradle that matches your requirements. For this tutorial, we will use Gradle 7.0.2.

Run the following command to download Gradle:

wget https://services.gradle.org/distributions/gradle-7.0.2-bin.zip -P /tmp

The above command will download Gradle 7.0.2 and save it to the /tmp directory.

Step 4: Extract Gradle

Extract the downloaded zip file to the /opt/gradle directory using the following commands:

sudo unzip -d /opt/gradle /tmp/gradle-7.0.2-bin.zip

This command will extract Gradle to the /opt/gradle/gradle-7.0.2 directory.

Step 5: Set up Environment Variables

To use Gradle from anywhere in your system, set up environment variables by creating a new file named gradle.sh in the /etc/profile.d directory using the following command:

sudo nano /etc/profile.d/gradle.sh

Add the following lines in the gradle.sh file:

export GRADLE_HOME=/opt/gradle/gradle-7.0.2
export PATH=${GRADLE_HOME}/bin:${PATH}

Save and close the file. Run the following command to inform the system about the environment variables:

source /etc/profile.d/gradle.sh

Step 6: Verify Gradle Installation

To verify if Gradle is installed and configured successfully, run the following command:

gradle -v

If everything is set correctly, the command should print the Gradle version information.

Congratulations! You have successfully installed Gradle on MXLinux Latest.

Conclusion

In this tutorial, we walked you through the installation process of Gradle on MXLinux. Now, you can enjoy building your Java projects using Gradle.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!