Installing Java and Setting Up
Site Admin
· 11 Sep 2026
· 11 views
Choosing a JDK
The two most common free JDKs are Oracle JDK and OpenJDK. For most learners and projects OpenJDK is the recommended choice because it is fully open source. Long-term support versions like 17 or 21 are the safest to learn on.
Installing on Windows
- Download the JDK installer from the OpenJDK or Oracle website.
- Run the installer and note the installation folder, for example
C:\Program Files\Java\jdk-17. - Add the
binfolder of the JDK to thePATHenvironment variable so the commandsjavaandjavacwork everywhere. - Open a new terminal and type
java -versionto verify.
Installing on Linux
sudo apt update
sudo apt install openjdk-17-jdk
java -versionInstalling on macOS
You can use Homebrew:
brew install openjdk@17
Finding Java on Your Machine
Besides java -version, you can print the exact installation path with:
java -XshowSettings:properties -version 2>&1 | grep java.homeKey Points
- Install a long-term support JDK (17 or 21).
- Set the
bindirectory onPATHso commands are reachable. - Verify with
java -versionbefore writing your first program.