How to Install OpenJDK on Windows

Published: May 19, 2020 (Updated: May 19, 2020)

Enjoying this content? Subscribe to the Channel!

Mastering Java: Install OpenJDK 14 on Windows 10 (The Easy Step-by-Step Guide)


Welcome to the World of OpenJDK 14!

If you’re ready to dive into Java development, you need a robust, reliable Java Development Kit (JDK) installed on your system. Today, we’re focusing on the highly efficient and widely used OpenJDK 14, and we’ll get it running perfectly on your Windows 10 machine.

Installing Java isn’t just about downloading files; it’s about properly configuring your operating system so that it knows where to find Java when you run commands or build applications. Don’t worry, we’re breaking down this technical process into clear, easy-to-follow steps. Let’s get started!


Step 1: Downloading and Preparing OpenJDK 14 Files

The first phase involves getting the necessary files and placing them in a permanent, secure location on your PC.

1.1 Download the OpenJDK Package

Navigate to a reliable distribution source (like AdoptOpenJDK, Oracle, or Microsoft’s own OpenJDK distribution) and download the OpenJDK 14 version compatible with Windows (usually a ZIP file).

1.2 Extract the Files

Once the download is complete, you will have a ZIP archive. Windows cannot run the JDK directly from a compressed file, so we need to extract it:

  1. Right-click the downloaded ZIP file.
  2. Select “Extract All.”
  3. Note the location where the folder is extracted. You should now have a folder named something like jdk-14 or openjdk-14.0.2.

1.3 Move OpenJDK to Program Files

It is best practice to install system-wide utilities in the Program Files directory. This ensures the files are secure and easily locatable.

  1. Copy the entire extracted OpenJDK folder (e.g., jdk-14).
  2. Navigate to your C: drive: C:\Program Files\.
  3. Paste the OpenJDK folder into this directory.

For the rest of this tutorial, we will assume your Java path is: C:\Program Files\jdk-14


Step 2: Configuring Environment Variables

This is the most critical step. We need to tell Windows where the Java installation lives. We do this by setting two key environment variables: JAVA_HOME and the Path variable.

2.1 Set the JAVA_HOME Environment Variable

The JAVA_HOME variable is used by many development tools (like Maven or Gradle) to automatically locate your Java installation.

  1. Search the Windows Start Menu for “Environment Variables” and select “Edit the system environment variables.”
  2. In the System Properties window, click the Environment Variables… button.
  3. Under the System variables section, click New….
  4. Enter the following details:
    • Variable name: JAVA_HOME
    • Variable value: C:\Program Files\jdk-14 (Use the exact path where you pasted your OpenJDK folder).
  5. Click OK to save the new variable.

2.2 Add Java to the Windows Path

The Windows Path variable dictates which directories the operating system searches through when you execute a command (like java). We need to add the bin directory of your OpenJDK installation to the Path.

  1. In the same Environment Variables window, locate the existing Path variable under System variables and click Edit….
  2. Click New and enter the following path: %JAVA_HOME%\bin
    • Pro Tip: Using %JAVA_HOME% here is better than typing the full path, as it relies on the variable you just set. If you ever upgrade Java, you only need to change the JAVA_HOME variable, and the Path automatically updates!
  3. Click OK on all open windows (Edit Environment Variable, Environment Variables, and System Properties) to apply the changes.

Step 3: Verifying Your OpenJDK Installation

You’ve downloaded, extracted, moved, and configured. Now for the moment of truth! We need to verify that Windows can successfully recognize and execute Java commands from any directory.

3.1 Run the Verification Command

  1. Open your Command Prompt (CMD) or PowerShell. You can do this by searching for “cmd” in the Start Menu.
  2. Enter the following command and press Enter:
java -version

3.2 Confirming Success

If the installation was successful, the Command Prompt will return details about the version you installed:

openjdk version "14.0.2" 2020-07-14
OpenJDK Runtime Environment (build 14.0.2+12)
...

If you see output similar to the above, congratulations! OpenJDK 14 is correctly installed and configured on your Windows 10 system!

If you receive an error like “java is not recognized as an internal or external command”, double-check Step 2.2 to ensure you correctly added %JAVA_HOME%\bin to your System Path variable.


Ready to Start Coding?

That’s all there is to it! You have successfully installed OpenJDK 14, configured your environment variables, and verified your setup. Your system is now a powerful development environment ready to tackle any Java project you throw at it.

Are you excited to start coding? Let me know in the comments below what project you’re starting next!

If this tutorial helped you get up and running, please smash that like button, subscribe to Darren’s Tech Tutorials for more clear, actionable guides, and hit the notification bell so you never miss an update. Happy coding!