DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk5 min

Installing Gradle on Ubuntu 24.04: Wrapper, JDK, and PATH Setup

Learn when a project's gradlew script makes a global Gradle install unnecessary, how to confirm JDK 17 or newer, and how to install Gradle on Ubuntu 24.04 with SDKMAN! or the official binary ZIP.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If a project already contains a gradlew script, you usually don’t need a global Gradle installation to build it. You still need a compatible Java Development Kit (JDK). If you do need a standalone gradle command, you can install it with SDKMAN! or by unpacking the official binary ZIP and adding it to your PATH. The steps below are the documented Linux procedure from Gradle’s own installation guide, applied to an Ubuntu 24.04 machine.

Check for the Gradle Wrapper first

Look in the project root for a gradlew script and a gradle/wrapper directory. If both are there, the project pins its own Gradle version, and you can run tasks with ./gradlew <task>. The Wrapper downloads and runs the configured Gradle version, so a separately installed Gradle is not needed for that project. Gradle’s installation guide puts it directly: “If the gradlew or gradlew.bat files are already present in your project, you do not need to install Gradle.” (Gradle, Inc., Installing Gradle, https://docs.gradle.org/current/userguide/installation.html)

As an Amazon Associate I earn from qualifying purchases.

The Wrapper does not remove the Java requirement. The machine still needs a JDK that the Gradle version supports.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Confirm the Java runtime

Run the following command in a terminal:

java -version

The guide for the current documentation version (Gradle 9.8.0 at the time of writing) states that Gradle requires JDK 17 or newer to run. If java -version reports an older release, or no Java at all, install a supported JDK before going further. On Ubuntu 24.04, the JDK 17 package from the standard repositories is one option:

sudo apt update
sudo apt install openjdk-17-jdk

Gradle chooses a JDK from the environment it runs in, the IDE, or project configuration. If several JDKs are installed, set JAVA_HOME to the one you want Gradle to use, for example:

export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
export PATH="$JAVA_HOME/bin:$PATH"

The path above is the usual location for the OpenJDK 17 package on amd64 systems. Confirm yours with ls /usr/lib/jvm before using it.

Choose an installation method

Gradle’s Linux guide documents two routes. They differ mainly in how versions are managed and how much control you keep over the installed files.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Factor SDKMAN! (sdk install gradle) Manual binary ZIP
Setup effort One command, once SDKMAN! itself is installed Download, unpack, and set PATH yourself
Version management Managed through SDKMAN! You choose the directory and keep one folder per version
Control over installed files Handled by SDKMAN! Full: you know exactly where Gradle lives
Performance or security difference Not stated by the source Not stated by the source

Use SDKMAN! if you want the shortest path and expect to switch Gradle versions often. Use the manual route if you want a fixed location you can inspect and control.

Option A: install with SDKMAN!

After SDKMAN! is set up in your shell, run:

sdk install gradle

SDKMAN! then makes the installed version available in your shell. Use gradle -v (covered below) to confirm the result.

Option B: install the binary ZIP manually

  1. Download the binary-only distribution, named gradle-<version>-bin.zip, from Gradle’s releases page. Gradle’s guide recommends the bin archive because it is smaller than the full distribution.
  2. Unpack it into a directory you choose. This example uses a directory in your home folder:
    mkdir -p "$HOME/opt/gradle"
    unzip gradle-<version>-bin.zip -d "$HOME/opt/gradle"

    Replace <version> with the release you downloaded. The unpacked folder will be $HOME/opt/gradle/gradle-<version>.

  3. Set GRADLE_HOME and add its bin directory to PATH:
    export GRADLE_HOME="$HOME/opt/gradle/gradle-<version>"
    export PATH="$GRADLE_HOME/bin:$PATH"
  4. Verify the command (see the next section).

These export lines apply only to the current shell session. To keep them, add the same two lines to the startup file your shell reads for interactive sessions. In Bash that is often ~/.bashrc, but check which file your terminal actually loads before editing it.

Keeping one directory per version makes upgrades easier: unpack the new release next to the old one, then change GRADLE_HOME to point at the new folder.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Verify the installation

Run:

gradle -v

The output shows the Gradle version, the build time, the Groovy and Kotlin versions, and the JVM Gradle is running on. Confirm that the JVM line reports a JDK 17 or newer.

Verify the download (optional but recommended)

Gradle publishes a SHA-256 checksum next to each distribution on its releases page. Follow Gradle’s checksum instructions for the file you downloaded. On Ubuntu, you can compute the local hash and compare it with the published value:

sha256sum gradle-<version>-bin.zip

If the two values differ, delete the file and download it again before unpacking it.

Starting a new project

If you are creating a project from scratch rather than cloning one, run gradle init inside the project directory. That command generates the Wrapper files, after which the project can be built with ./gradlew and does not depend on the global installation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Troubleshooting

  • gradle: command not found. The bin directory is not on PATH in the current shell. Run echo $PATH and confirm it includes $GRADLE_HOME/bin.
  • The wrong Gradle version runs. Another installation earlier in PATH is taking precedence. Run which -a gradle to list every match in PATH order.
  • Gradle fails with a Java or JVM error. The JDK found is missing or older than 17. Run java -version, then set JAVA_HOME to a JDK 17 or newer, as described above.
  • A Gradle package from the Ubuntu or another Linux package manager behaves differently. Gradle’s guide warns that Linux package managers may distribute a modified version that is incompatible or incomplete compared with the official release, and that Gradle, Inc. does not control those packages. If you see unexpected behaviour, try the SDKMAN! or official ZIP route instead.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Scope of these instructions

The procedure above is the general Linux procedure documented by Gradle, Inc. The guide covers Linux in general and does not list Ubuntu 24.04 as a separately tested host, so this article does not claim Ubuntu-specific certification. The steps have been written to work on a standard Ubuntu 24.04 setup, but the version numbers and paths should be checked against the current installation page linked above.

Best Value

Gradle’s documentation changes with each release. The version named here is the one shown in the guide at the time of writing; check the current installation page before pinning a version in scripts or team documentation.

Once gradle -v works, you can use the standalone command for new projects, and rely on ./gradlew for any project that already contains a Wrapper.

”

The Bottom Line

“”

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.