Day 0 of 22 · ~9 min
Set up your toolchain
Objective. Install JDK 21 and prove it works with two commands.
Why this matters. More beginners quit at setup than at any concept. Ten minutes here and every later day is pure learning.
Install JDK 21
Java needs a JDK (Java Development Kit) — the compiler plus the runtime. Get version 21, the current long-term-support release.
Download an installer from Adoptium for Windows, macOS, or Linux. On macOS or Linux you can instead use SDKMAN!:
sdk install java 21-tem
Prove it works
Open a new terminal — a fresh one, so it picks up the install — and run both commands:
java -version
javac -version
Output
openjdk version "21.0.3" 2024-04-16 LTS
javac 21.0.3
Two tools, two answers, both saying 21. That is the entire day.
Setting up a toolchain is stocking a kitchen before you cook. Nobody tastes the shopping trip, but without it you cannot make dinner.
If either command says command not found, the installer did not reach your PATH (the list of folders your terminal searches for programs). Close and reopen the terminal first — that fixes it most of the time. On Windows, re-run the installer and tick "Set JAVA_HOME / add to PATH."
Try it
- run it: run both version commands in a new terminal.
- tweak it: run
java --helpand skim what the launcher can do. - break it: type
javaa -versionand read the error — that is what a missing command looks like, so you will recognize it later. - build it: make a folder for this course; you will write your first file there tomorrow.
Check yourself
1. Which two commands prove your JDK install worked, and what does each one do?
2. You installed the JDK but the terminal says
command not found. What is the most likely cause and the first thing to try?
My notes
Yours alone, kept in this browser.