How to Install OpenJDK on Windows
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:
- Right-click the downloaded ZIP file.
- Select “Extract All.”
- Note the location where the folder is extracted. You should now have a folder named something like
jdk-14oropenjdk-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.
- Copy the entire extracted OpenJDK folder (e.g.,
jdk-14). - Navigate to your C: drive:
C:\Program Files\. - 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.
- Search the Windows Start Menu for “Environment Variables” and select “Edit the system environment variables.”
- In the System Properties window, click the Environment Variables… button.
- Under the System variables section, click New….
- 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).
- Variable name:
- 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.
- In the same Environment Variables window, locate the existing
Pathvariable under System variables and click Edit…. - 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 theJAVA_HOMEvariable, and the Path automatically updates!
- Pro Tip: Using
- 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
- Open your Command Prompt (CMD) or PowerShell. You can do this by searching for “cmd” in the Start Menu.
- 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!