Installing the JDK & Setting Up the Environment in Java
To write and run Java, you need the JDK (Java Development Kit) — not just a JRE (Java Runtime Environment). The JRE can only run already-compiled programs; the JDK additionally bundles the compiler (javac) and other development tools, so it's what you actually need to build anything. Several free, spec-compliant JDK builds exist — Oracle JDK, Eclipse Temurin, Amazon Corretto, Microsoft Build of OpenJDK — and picking between them is mostly a question of licensing and support preferences, not language behavior, since they all implement the same Java specification.
Once installed, setup is refreshingly small: the installer (or a version manager like SDKMAN) puts java and javac on your system PATH and usually sets a JAVA_HOME environment variable that other tools rely on. There's no separate package manager step or virtual environment to create just to get a basic program running — two working command-line tools is the whole bar to clear.
Choose a version
LTS releases (17, 21, and so on) are the practical default for stability; newer non-LTS releases add features sooner but drop support faster.
Choose a distribution
Oracle JDK, Eclipse Temurin, Amazon Corretto, and Microsoft Build of OpenJDK are all free, spec-compliant builds of the same language — pick based on OS support or a company's licensing policy.
Install and set PATH / JAVA_HOME
The installer — or a version manager like SDKMAN — puts java and javac on your PATH and typically sets JAVA_HOME, which build tools and IDEs look for.
Verify the install
Running java -version and javac -version in a terminal confirms both the runtime and the compiler are installed and report matching versions.
Pick an editor or IDE
A plain text editor works, but an IDE like IntelliJ IDEA or VS Code with its Java extension pack adds inline compiler errors, autocomplete, and one-click run/debug.
$ java -version$ javac -versionRecommended resourcesAffiliate links · may earn us a commission
Recommended for learners
Practice what you learned
Re-implement each visualized algorithm in Java yourself — building beats watching.