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

  1. Download the JDK installer from the OpenJDK or Oracle website.
  2. Run the installer and note the installation folder, for example C:\Program Files\Java\jdk-17.
  3. Add the bin folder of the JDK to the PATH environment variable so the commands java and javac work everywhere.
  4. Open a new terminal and type java -version to verify.

Installing on Linux

sudo apt update
sudo apt install openjdk-17-jdk
java -version

Installing 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.home

Key Points

  • Install a long-term support JDK (17 or 21).
  • Set the bin directory on PATH so commands are reachable.
  • Verify with java -version before writing your first program.
Share this post:

Comments (0)

Please login or register to comment.