How to Install OpenJDK on Windows

Last Updated : 7 May, 2026

Java development requires the Java Development Kit (JDK) to build and run applications. OpenJDK is the free and open-source version of Java that includes all the essential tools for development. It is widely used on Linux systems because it is stable, easy to install, and supported by most distributions.

Why OpenJDK matters:

  • It provides all the necessary tools (JRE, JVM, and compiler) required to develop and run Java applications.
  • It is free, reliable, and officially supported across most Linux distributions, making it a trusted choice for developers.

System Requirements to Install OpenJDK in Windows

  • OS: Windows 10 (version 1903 or later) or any version of Windows 11
  • Processor: Minimum 1 GHz processor (2 GHz or faster is recommended)
  • Disk Space: Minimum 300 MB free space
  • RAM: Minimum 2 GB of RAM (4 GB is better for smoother performance)

How to Install OpenJDK on Windows

Follow the steps below to install OpenJDK on Windows 10 or Windows 11.

Step 1: Download OpenJDK

  • Open your web browser and go to the official OpenJDK website or trusted providers like Adoptium or Amazon Corretto.
  • Choose the latest version of OpenJDK that matches your requirements.
  • Download the Windows installer (.msi) or ZIP archive for the 64-bit version

Step 2: Install OpenJDK

If you downloaded the installer:

  • Once download is completed double-click on the downloaded installer file.
  • Follow the instructions in the installation wizard.
  • Select the installation directory or use the default one provided.
  • Click “Install” and wait for the installation to complete.

If you downloaded the ZIP file

  • Locate the downloaded ZIP file and extract it to a folder on your computer. For example, you can extract it to C:\Program Files\OpenJDK.
  • Remember the folder path where you extracted OpenJDK, as you will need it later.

Step 3: Set Up Environment Variables

You need to set up environment variables to run Java programs from the command prompt.

  • Open and search for "Environment Variables" in the Start menu and select "Edit the system environment variables".
  • Click on “Edit the system environment variables”.
  • In the System Properties window, click on the “Environment Variables” button.
  • Under “System Variables”, find the “Path” variable and select it, then click “Edit”.
  • Click “New” and enter the path to the bin folder of your JDK installation directory. For example, C:\Program Files\OpenJDK\bin.
  • Click “OK” to save the changes.

Step 4: Verify the Installation

  • Open the command prompt by pressing Win + R, type cmd, and hit Enter to open Command Prompt.
  • Type the following command to check the Java version:

java -version

  • If OpenJDK is installed correctly, you will see the version details displayed in the command prompt.

Step 5: Run Your First Java Program

  • Now that OpenJDK is installed and configured, you can run your first Java program.
  • Create a new file named HelloWorld.java using a text editor like Notepad.
  • Write the following code in the file:

public class HelloWorld {

public static void main(String[] args) {

System.out.println("Hello, World!");

}

}

  • Save the file as HelloWorld.java in a folder like, for example, C:\JavaProjects.
  • Open the command prompt and navigate to the folder where you saved the file using the cd command.

cd C:\JavaProjects

  • Compile the program using the following command:

javac HelloWorld.java

  • Run the program using the command:

java HelloWorld

  • If everything is set up correctly, you will see the message “Hello, World!” displayed in the command prompt.
Comment