Installing the JDK on Your Operating System
What you'll learn: How to download and install the JDK on Windows, macOS, or Linux so you can start writing Java programs.
Now that you've chosen a JDK distribution (like Oracle JDK or OpenJDK), it's time to actually install it on your computer. Think of this like installing any other software—you download an installer, run it, and follow the prompts. The JDK will place all the necessary tools on your machine so you can compile and run Java code.
Windows Installation
- Download: Visit the JDK provider's website (Oracle or Adoptium for OpenJDK) and download the Windows
.exeinstaller - Run: Double-click the downloaded file
- Follow the wizard: Click "Next" through the installation screens, accepting the default installation location (usually
C:\Program Files\Java\jdk-[version]) - Verify: The installer handles most setup automatically
macOS Installation
- Download: Get the macOS
.dmgfile from your chosen JDK provider - Open: Double-click the
.dmgfile - Install: Drag the JDK icon to the Applications folder or run the
.pkginstaller - Complete: Follow any on-screen prompts
Linux Installation
- Download: Get the Linux
.tar.gzarchive or use your package manager - Extract (if using archive): Unpack to a directory like
/opt/jdk-[version] - Or use package manager: For example,
sudo apt install openjdk-17-jdkon Ubuntu
After Installation
You'll later verify the installation worked by checking the JDK version—but first, the software needs to be on your system.
Key Takeaway: Installing the JDK is straightforward: download the installer for your operating system, run it, and follow the installation wizard to place Java's development tools on your computer.