OpenJDK is the open-source implementation of the Java Platform, Standard Edition (Java SE). It includes everything you need to develop and run Java applications, including the Java Runtime Environment (JRE), Java Virtual Machine (JVM), and Java Development Kit (JDK). Whether you’re learning Java programming, developing desktop applications, building Android apps, or running enterprise software, OpenJDK is one of the most popular Java distributions available.
Installing OpenJDK on Windows 11 is straightforward, but it requires a few additional configuration steps to ensure Java commands work correctly from Command Prompt, PowerShell, and Windows Terminal. Once installed, you’ll be able to compile Java programs, run Java applications, and use development tools without additional setup.
In this guide, you’ll learn how to download, install, configure, and verify OpenJDK on Windows 11.
What Is OpenJDK?
OpenJDK (Open Java Development Kit) is the official open-source implementation of Java.
It includes:
- Java Development Kit (JDK)
- Java Compiler (javac)
- Java Virtual Machine (JVM)
- Java Runtime Environment (JRE)
- Standard Java libraries
- Development and debugging tools
Many popular Java distributions, such as Eclipse Temurin, Amazon Corretto, Microsoft Build of OpenJDK, and Oracle’s OpenJDK builds, are based on the OpenJDK project.
System Requirements
Before installing OpenJDK, ensure your PC meets these requirements:
- Windows 11 (64-bit recommended)
- At least 2 GB of RAM
- Around 500 MB of free storage
- Administrator privileges
- Internet connection to download the installer
Method 1: Download OpenJDK
The easiest way to install OpenJDK is by downloading a Windows installer from a trusted OpenJDK distribution.
Choose:
- Latest Long-Term Support (LTS) version if available.
- Windows x64 installer (or ARM64 if your device uses an ARM processor).
- MSI installer when available for easier installation.
Download the installer and save it to your computer.
Method 2: Install OpenJDK
After downloading:
- Double-click the installer.
- Approve the User Account Control prompt.
- Click Next.
- Accept the license if required.
- Choose the installation folder.
- Continue through the installation wizard.
- Click Install.
- Wait for the installation to complete.
- Click Finish.
OpenJDK is now installed on your PC.
Method 3: Verify the Installation
Open Command Prompt.
Run:
java -version
If Java is installed correctly, you’ll see version information similar to:
openjdk version "21"
Next, verify the Java compiler:
javac -version
The installed compiler version should be displayed.
Method 4: Configure the PATH Environment Variable
If the java or javac commands are not recognized, add OpenJDK to your system PATH.
- Press Windows + S.
- Search for Edit the system environment variables.
- Click Environment Variables.
- Under System variables, select Path.
- Click Edit.
- Choose New.
- Add the path to the bin folder inside your OpenJDK installation.
Example:
C:\Program Files\OpenJDK\bin
- Click OK to save the changes.
- Close and reopen Command Prompt.
Run:
java -version
again to confirm the PATH is configured correctly.
Method 5: Set the JAVA_HOME Variable
Many Java applications require the JAVA_HOME environment variable.
To configure it:
- Open Environment Variables.
- Under System variables, click New.
- Enter:
Variable name
JAVA_HOME
Variable value
C:\Program Files\OpenJDK
Replace the path with your actual installation directory.
Click OK.
Some applications automatically detect Java once JAVA_HOME is configured.
Method 6: Test Java with a Simple Program
Create a new file named:
HelloWorld.java
Add the following code:
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
Open Command Prompt in the file’s location.
Compile the program:
javac HelloWorld.java
Run it:
java HelloWorld
If everything is configured correctly, the program will display:
Hello, World!
Method 7: Install OpenJDK Using Windows Package Manager (Winget)
Windows 11 includes Winget, which can install many software packages directly from the command line.
Open Command Prompt or Windows Terminal as Administrator.
Search for available OpenJDK packages:
winget search openjdk
Review the available distributions and install the one you prefer using its package ID.
After installation, verify it with:
java -version
Method 8: Update OpenJDK
Keeping Java updated improves performance, compatibility, and security.
If you installed OpenJDK manually:
- Download the latest installer from your chosen distribution.
- Run the installer to upgrade your existing installation.
If you installed it using Winget:
winget upgrade
or upgrade the specific Java package using its package ID.
Method 9: Uninstall OpenJDK
If you no longer need Java:
- Open Settings.
- Go to Apps > Installed apps.
- Locate your OpenJDK distribution.
- Click Uninstall.
- Follow the removal wizard.
If necessary, remove outdated JAVA_HOME and Path entries from the Environment Variables settings.
Common Installation Problems and Solutions
“java” Is Not Recognized
The OpenJDK bin folder is likely missing from the PATH environment variable. Add the correct directory and reopen your terminal.
“javac” Is Not Recognized
Verify that the JDK—not just a runtime—is installed, and ensure its bin folder is included in the PATH.
Multiple Java Versions Installed
Use:
where java
to see which Java executable Windows is using. Remove or reorder PATH entries if an older version is taking precedence.
Incorrect JAVA_HOME
Double-check that JAVA_HOME points to the root of the JDK installation rather than the bin folder.
Tips for Using OpenJDK
To get the best experience:
- Install an LTS version for long-term stability.
- Keep Java updated with the latest security patches.
- Set both
JAVA_HOMEandPathcorrectly. - Use an integrated development environment (IDE) such as IntelliJ IDEA, Eclipse, or Visual Studio Code with Java extensions.
- Remove unused or outdated Java versions to avoid conflicts.
Conclusion
OpenJDK provides everything you need to develop and run Java applications on Windows 11. After downloading and installing a trusted OpenJDK distribution, configuring the Path and JAVA_HOME environment variables ensures Java tools work seamlessly from Command Prompt, PowerShell, Windows Terminal, and development environments.
By verifying the installation with java -version and javac -version, testing a simple Java program, and keeping your installation updated, you’ll have a reliable Java development environment ready for learning, application development, and enterprise projects.
Frequently Asked Questions
1. Is OpenJDK free?
Yes. OpenJDK is open-source and free to download, use, and distribute under its applicable licenses.
2. What’s the difference between OpenJDK and Oracle JDK?
Both are based on the same Java platform, but they differ in licensing, support, update policies, and distribution. Many OpenJDK distributions are suitable for both development and production use.
3. Do I need to set JAVA_HOME?
Not always. Basic Java programs can run without it, but many development tools and build systems require JAVA_HOME to locate the JDK.
4. Can I install multiple Java versions?
Yes. Windows supports multiple JDK installations, but you should configure your Path and JAVA_HOME variables carefully to ensure the correct version is used.


