How to Install OpenJDK on Windows?

If you’re dipping your toes into Java development or setting up a new dev environment, one of the first things you’ll need to do is install OpenJDK on Windows. Sounds fancy, but don’t worry, it’s a pretty straightforward process once you know where to click and what to check.

In this guide, we’ll walk you through the entire process of installing OpenJDK on Windows, from downloading the right version to setting up your environment variables (the not-so-fun but necessary part). So, let’s get into it.

What is OpenJDK Anyway?

OpenJDK stands for Open Java Development Kit. It’s the free, open-source implementation of the Java Platform, Standard Edition. In essence, it provides the compiler, the Java Virtual Machine (JVM), and the essential libraries required to compile and run Java code.

And no, you don’t need to install the old Oracle JDK unless you have some very specific corporate requirements. OpenJDK does the job just fine for most use cases, and it’s license-friendly too.

Prerequisites

Before starting to Install OpenJDK on Windows, here’s a quick checklist to make sure your system is ready:

  • You’re running Windows 10 or 11.
    • A 64-bit version of Windows 10 (version 1607 or later) or Windows 11
    • At least 2 GB of RAM (4 GB or more is recommended if you plan to use an IDE)
    • At least 200 MB of free disk space for the JDK itself
  • Have admin rights (you’ll need them to install the JDK system-wide and set environment variables).
  • Connected to the internet (because, well, for the downloads).

Alright, let’s get to the fun part.

Installing OpenJDK on Windows

1. Download OpenJDK

You can grab the OpenJDK binaries from a few trusted sources. Some popular ones include:

For this guide, we’ll go with Adoptium, since it’s pretty straightforward and reliable.

  1. Head over to https://adoptium.net.
  2. Choose your Windows architecture (most people can go with the default x64).
  3. Download the .msi installer (easier than the .zip if you want minimal setup hassle).

2. Run the Installer

Once the .msi file is downloaded:

  1. Double-click it to launch the installer.
  2. Follow the on-screen instructions.
  3. Make sure to check the box that says “Set JAVA_HOME variable.” This saves you from doing it manually.
  4. Finish the installation.

Verifying Your Installation

Now let’s make sure everything’s working.

1. Open a Command Prompt

Press Win + R, type cmd, and press Enter.

2. Check Java Version

Type this:

You should see something like:

Then try:

This confirms the Java compiler (javac) is working too.

Manually Setting JAVA_HOME (if needed)

If you didn’t check the “Set JAVA_HOME” box during installation, here’s how to do it manually:

  1. Right-click This PC > Properties > Advanced system settings.
  2. Click “Environment Variables.”
  3. Under System Variables, click “New.”
    • Variable name: JAVA_HOME
    • Variable value: Path to your JDK folder (e.g., C:\Program Files\Eclipse Adoptium\jdk-17.0.9.11-hotspot)
  4. Click “OK.”

Now add it to the Path variable:

  1. Find the Path variable under System Variables and click “Edit.”
  2. Click “New,” and type %JAVA_HOME%\bin.
  3. Click “OK” for your way out.

Restart the terminal and try java -version again.

Bonus Tips

  • Use an IDE: If you’re coding Java seriously, install an IDE like IntelliJ IDEA, Eclipse, or Visual Studio Code with the Java extension. They’ll detect your JDK automatically.
  • Multiple JDKs? Use a version manager like SDKMAN! (for WSL/Linux) or jEnv. On Windows, consider Jabba.
  • Environment Conflicts? If java -version doesn’t return what you expect, make sure no other Java versions are lurking in your system’s PATH.

Conclusion

And that’s it! A smooth, no-fuss way to install OpenJDK on Windows and get your Java environment up and running. Now you can start building, testing, and running Java applications like a pro. Go ahead and fire up your favorite IDE or text editor and start writing some Java magic. If anything doesn’t work the way it should, a quick check of your environment variables usually does the trick.

Got stuck anywhere? Drop your questions in the comments. If you have Linux system and needs Java, you can check our post about installing OpenJDK on Linux.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *