Phase 1 20 min windows macos linux

Install Java JDK 25

The compiler and runtime for all your Java programs

What You’re Installing

The JDK (Java Development Kit) includes everything you need to write and run Java programs: the compiler (javac), the runtime (java), and standard libraries. The JRE (Java Runtime Environment) is a subset that only runs programs — you need the full JDK because you’re writing them. Under the hood, both use the JVM (Java Virtual Machine) to execute your compiled code.

This course uses JDK 25 (Eclipse Temurin by Adoptium). Not JDK 21, not JDK 17. If you have another version installed, you still need 25.

Check If You Already Have It

Open a terminal and run:

java --version

If you see output containing openjdk 25 and Temurin, you’re done — skip to Verify. If you get “command not found” or a different version, keep reading.

Install JDK 25

Download from the official Adoptium site: https://adoptium.net/

Make sure you select:

  • Version: JDK 25
  • Distribution: Eclipse Temurin
  • Your operating system and architecture
Windows 1. Download the `.msi` installer from [adoptium.net](https://adoptium.net/). 2. Run the installer. 3. **Important:** On the "Custom Setup" screen, enable these options: - "Set JAVA_HOME variable" — **set to "Will be installed on local hard drive"** - "Add to PATH" — **set to "Will be installed on local hard drive"** 4. Click through to finish. 5. **Close and reopen** any terminal/PowerShell windows. The PATH changes won't take effect in terminals that were already open.
macOS **Option A: Homebrew (recommended if you have it)** ```bash brew install --cask temurin@25 ``` **Option B: Manual installer** 1. Download the `.pkg` installer from [adoptium.net](https://adoptium.net/). 2. Double-click to install. Follow the prompts. 3. The installer sets `JAVA_HOME` and updates your `PATH` automatically. After installing, close and reopen your terminal.
Linux (Ubuntu/Debian) ```bash sudo apt update sudo apt install -y wget apt-transport-https gpg wget -qO - https://packages.adoptium.net/artifactory/api/gpg/key/public | sudo gpg --dearmor -o /usr/share/keyrings/adoptium.gpg echo "deb [signed-by=/usr/share/keyrings/adoptium.gpg] https://packages.adoptium.net/artifactory/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/adoptium.list sudo apt update sudo apt install -y temurin-25-jdk ``` For Fedora or Arch, see the [Adoptium installation guide](https://adoptium.net/installation/).

Verify

Open a new terminal window and run both of these:

java --version

Expected output (version numbers may differ slightly):

openjdk 25 2025-09-16
OpenJDK Runtime Environment Temurin-25+...
OpenJDK 64-Bit Server VM Temurin-25+...
javac --version

Expected output:

javac 25

Both commands must show version 25. If they don’t, see the troubleshooting section below.

Common Errors

“command not found” or “‘java’ is not recognized”

The JDK isn’t on your PATH. On Windows, re-run the installer and make sure “Add to PATH” is enabled. On macOS/Linux, close and reopen your terminal. If that doesn’t work, check that the Adoptium bin directory is in your PATH:

echo $PATH    # macOS/Linux
echo %PATH%   # Windows Command Prompt

Wrong version shows up (e.g., java 17 or java 21)

You have multiple JDKs installed. The old one is earlier on your PATH. Fix this by either:

  • Uninstalling the old JDK
  • Setting JAVA_HOME to point to the JDK 25 installation and putting $JAVA_HOME/bin first in your PATH

To find where your JDKs are installed:

# macOS
/usr/libexec/java_home -V

# Linux
update-alternatives --list java

# Windows (PowerShell)
Get-Command java | Select-Object -ExpandProperty Source

“JAVA_HOME is not set” (shows up later with Gradle)

Set it manually:

# macOS/Linux — add to ~/.bashrc or ~/.zshrc
export JAVA_HOME=$(/usr/libexec/java_home -v 25)  # macOS
export JAVA_HOME=/usr/lib/jvm/temurin-25-jdk-amd64  # Linux (path may vary)

On Windows, the Temurin installer should have set this. If it didn’t:

  1. Search “Environment Variables” in the Start menu.
  2. Under System Variables, click New.
  3. Variable name: JAVA_HOME
  4. Variable value: the path to your JDK (e.g., C:\Program Files\Eclipse Adoptium\jdk-25...)

Quick Test

Create a file called Hello.java with this content:

public class Hello {
    public static void main(String[] args) {
        System.out.println("JDK 25 is working.");
    }
}

Compile and run it:

javac Hello.java
java Hello

If you see JDK 25 is working. — you’re good. Delete the test files and move on to installing Git.