Course contentsShow
Java
Lesson 4 of 2,8701. Java Setup and First ProgramFree lesson

Installing the JDK on Your Operating System

Step-by-step installation of the JDK on Windows, macOS, or Linux, including downloading and running installers.

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

  1. Download: Visit the JDK provider's website (Oracle or Adoptium for OpenJDK) and download the Windows .exe installer
  2. Run: Double-click the downloaded file
  3. Follow the wizard: Click "Next" through the installation screens, accepting the default installation location (usually C:\Program Files\Java\jdk-[version])
  4. Verify: The installer handles most setup automatically

macOS Installation

  1. Download: Get the macOS .dmg file from your chosen JDK provider
  2. Open: Double-click the .dmg file
  3. Install: Drag the JDK icon to the Applications folder or run the .pkg installer
  4. Complete: Follow any on-screen prompts

Linux Installation

  1. Download: Get the Linux .tar.gz archive or use your package manager
  2. Extract (if using archive): Unpack to a directory like /opt/jdk-[version]
  3. Or use package manager: For example, sudo apt install openjdk-17-jdk on 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.