Open In App

How to Install OpenJDK on Windows - A Simple, Beginner-Friendly Guide

Last Updated : 23 Jul, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

Java is one of the most widely used programming languages in the world, consistently ranking in the top 10. If you're just starting to learn Java, the first thing you'll need is the Java Development Kit (JDK) installed on your computer.

This step-by-step guide is one place to know how to install OpenJDK in a Windows system, how to verify the installation, and how to run your first Java program. Also, the procedure you are following in this article is applicable on Windows 10 and Windows 11 also.

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 (Free Java) in Windows

In this section we are going to discuss the step-by-step process to install OpenJDK in Windows 10 and 11. So, follow these steps and complete the installation process by yourself.

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.

Conclusion

You have successfully installed OpenJDK on your Windows computer and run your first Java program. OpenJDK provides a free and reliable way to work with Java, making it an excellent choice for developers. Now you can start learning and building Java applications with ease.


Similar Reads