Practices:

How to Install Java JRE on Windows, macOS, and Linux

Java Runtime Environment (JRE) provides the libraries and components required to run Java applications. This guide shows step-by-step instructions for installing the JRE on Windows, macOS, and common Linux distributions, plus verification and basic troubleshooting.

Before you begin

  • Decide whether you need the JRE specifically or the full JDK (Java Development Kit). The JDK includes the JRE plus development tools; many applications now require or bundle a JDK.
  • Choose a Java distribution and version. Common options include Oracle JRE/JDK, Eclipse Temurin (Adoptium), Amazon Corretto, Azul Zulu, and Liberica. Use an LTS (long-term support) version like Java 17 or Java 11 unless an application requires another version.
  • Check system architecture (64-bit vs 32-bit) and OS version.

1. Install on Windows

Option A Install from an OpenJDK build (recommended)

  1. Download:
    • Visit the vendor site (e.g., Temurin, Corretto, Azul) and download the Windows x64 installer for the desired Java version.
  2. Run installer:
    • Double-click the downloaded .msi or .exe and follow prompts. Accept defaults unless you need a custom path.
  3. Set PATH (optional but useful):
    • Open Start Settings System About Advanced system settings Environment Variables.
    • Under System variables, edit Path and add the JRE/JDK bin folder (e.g., C:\Program Files\Eclipse Adoptium\jdk-17\bin).
  4. Verify:
    • Open Command Prompt and run:
      java -version

      You should see the installed Java version.

Option B Oracle Java (if required)

  1. Oracle often requires an Oracle account and has license terms; download the Windows installer from oracle.com/java.
  2. Follow the installer and verify with java -version.

2. Install on macOS

Option A Install via package from vendor

  1. Download:
    • Get the macOS .pkg (or .dmg) for the chosen distribution and version (x64 or aarch64 for Apple Silicon).
  2. Install:
    • Open the .pkg and follow the installer prompts. For .dmg, copy the .jdk or .pkg to Applications and run.
  3. Verify:
    • Open Terminal and run:
      java

Option B Install with Homebrew (recommended for convenience)

  1. Install Homebrew if you don’t have it:
    /bin/bash -c ”$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)”
  2. Install a Java distribution, e.g. Temurin 17:
    brew install –cask temurin
  3. Verify:
    java -version

Notes:

  • On Apple Silicon, prefer aarch64 builds (arm64) or use Rosetta for x64 versions.
  • macOS may prompt to allow the app in Security & Privacy if installer is from an unidentified developer.

3. Install on Linux

General steps vary by distribution. Below are packages for common distros.

Debian / Ubuntu (APT)

  1. Update packages:
    sudo apt update
  2. Install Temurin JRE (example) or default-jre:
    sudo apt install default-jre

    Or to install a specific vendor/package:

    sudo apt install temurin-17-jre
  3. Verify:
    java -version

Fedora / CentOS / RHEL (DNF/YUM)

  1. Update:
    sudo dnf update
  2. Install default JRE or a vendor package:
    sudo dnf install java-17-openjdk
  3. Verify:
    java -version

Arch Linux

  1. Use pacman:
    sudo pacman -Syu jre-openjdk
  2. Verify:
    java -version

Manual tarball install (any distro)

  1. Download the tar.gz from vendor.
  2. Extract to /opt:
    sudo tar -xzf openjdk-17_linux-x64bin.tar.gz -C /opt/
  3. Create symlink or update alternatives:
    sudo update-alternatives –install /usr/bin/java java /opt/jdk-17/bin/java 1sudo update-alternatives –config java
  4. Verify:
    java -version

4. Verify installation and troubleshoot

    &]:pl-6” data-streamdown=“unordered-list”>

  • java -version should show version and vendor.
  • If command not found: ensure bin folder is in PATH or alternatives are configured.
  • On Windows, check PATH and JAVA_HOME environment variables (some apps need JAVAHOME set).
  • macOS Gatekeeper: allow installer under System Settings Privacy & Security.
  • Permission issues on Linux: use sudo for system-wide installs.
  • Conflicting versions: use update-alternatives (Linux) or manage PATH to prioritize desired java.

5. Security and updates

    &]:pl-6” data-streamdown=“unordered-list”>

  • Keep Java updated; use vendor packages or package manager to receive updates.
  • Avoid installing older unsupported versions unless an application requires them; isolate legacy installs.

6. Quick

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