Install JDK and Tooling
Set up JDK 21+, configure JAVA_HOME/PATH, and pick a productive Java IDE.
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).
JDK download links
- Eclipse Temurin JDK 21 (recommended)
- Oracle JDK 21
- Amazon Corretto 21
- Azul Zulu JDK 21
- Microsoft Build of OpenJDK
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%\bintoPath
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 -versionandjavac -versionreturn 21+JAVA_HOMEpoints to your intended JDK- IDE project SDK uses the same JDK
- A simple
HelloWorldcompiles and runs
With this baseline, you are ready for the next Java roadmap steps.