Back to Java Roadmap

Install JDK and Tooling

Set up JDK 21+, configure JAVA_HOME/PATH, and pick a productive Java IDE.

#java #setup #jdk #tooling

Why this step matters

Before writing Java code, your environment must be correct and reproducible. A clean setup avoids hidden issues between local, staging, and production environments.

Install JDK 21+

Use an LTS distribution (Temurin, Oracle JDK, Corretto, or Zulu). Verify installation:

java -version
javac -version

Expected output should show version 21 (or newer).

Set JAVA_HOME and PATH

Make sure both are configured system-wide so terminal, IDE, Maven, and Gradle all use the same JDK.

macOS (zsh)

# ~/.zshrc
export JAVA_HOME=$(/usr/libexec/java_home -v 21)
export PATH="$JAVA_HOME/bin:$PATH"

Apply changes:

source ~/.zshrc

Linux

# ~/.bashrc or ~/.zshrc
export JAVA_HOME=/path/to/jdk-21
export PATH="$JAVA_HOME/bin:$PATH"

Windows (PowerShell)

Set environment variables in System Settings:

  • JAVA_HOME=C:\Program Files\Java\jdk-21
  • Add %JAVA_HOME%\bin to Path

Then reopen your terminal and check:

java -version

Use IntelliJ or VS Code

Choose one IDE and configure it properly.

Recommendation

For Java projects, I recommend using IntelliJ IDEA over VS Code for a more complete and reliable developer experience.

IntelliJ IDEA

  • Download: IntelliJ IDEA
  • Set project SDK to JDK 21+
  • Enable auto-import for Maven/Gradle
  • Install Java and Spring plugins if needed

IntelliJ Setup Video

VS Code

  • Download: Visual Studio Code
  • Install Extension Pack for Java
  • Install Language Support for Java(TM) by Red Hat
  • Set default Java runtime to your JDK 21+

Quick validation checklist

  • java -version and javac -version return 21+
  • JAVA_HOME points to your intended JDK
  • IDE project SDK uses the same JDK
  • A simple HelloWorld compiles and runs

With this baseline, you are ready for the next Java roadmap steps.