OpenJDK 11 Installation Guide for Windows
In this article
To install OpenJDK 11 on Windows, you must download the binaries from a trusted provider (such as Adoptium or Oracle), extract the files to a permanent folder, and manually configure the JAVA_HOME system environment variable and the Path variable. This process provides the Java Runtime Environment (JRE) and the Java Development Kit (JDK) necessary to run and develop Java applications.
What You'll Need
- A Windows PC (Windows 10 or 11 recommended).
- An active internet connection to download the JDK binaries.
- Administrative privileges on the computer to modify system environment variables.
- A zip utility (Windows has built-in support for .zip files, but tools like 7-Zip are also common).
Step-by-Step
- Select a Distribution: Since OpenJDK is the open-source reference implementation, several vendors provide builds. Navigate to a reputable source such as Adoptium (Eclipse Temurin) or the official Oracle OpenJDK page. Look specifically for the Java 11 (LTS) version, as this is a Long-Term Support release.
- Download the Binaries: Choose the Windows x64 installer or the .zip archive. If you use the .zip archive, you have more control over the installation directory. Download the file to your Downloads folder.
- Extract the Files: If you downloaded a .zip file, right-click it and select Extract All. Choose a directory that is unlikely to be deleted or moved. A professional standard is to create a folder named
C:\Javaand extract the JDK there. Your final path should look something likeC:\Java\jdk-11.x.x. Avoid installing Java in the Program Files folder if you encounter permission issues during configuration, although it is the default for .msi installers. - Open System Environment Variables: Click the Start button and type "env". Select the option that says Edit the system environment variables. This opens the System Properties window. Click the Environment Variables button at the bottom right. Note that menu labels may vary slightly depending on your version of Windows or regional settings.
- Create the JAVA_HOME Variable: In the System variables section (the bottom half of the window), click New. For the Variable name, type
JAVA_HOME. For the Variable value, click Browse Directory and navigate to the root folder where you extracted OpenJDK 11 (e.g.,C:\Java\jdk-11.x.x). Click OK. This variable tells other software where the Java installation is located. - Update the Path Variable: In the same System variables section, find the variable named
Path, select it, and click Edit. Click New on the right side of the window. Type%JAVA_HOME%\bin. This tells Windows to look in the Java bin folder for executable files like javac and java. Click OK to close the Edit Environment Variable window. - Save and Exit: Click OK on the Environment Variables window, and then click OK on the System Properties window to apply the changes.
- Verify the Installation: Open a new Command Prompt window (press Win + R, type
cmd, and hit Enter). It is vital to open a new window because existing windows will not recognize the updated environment variables. Type the following command and press Enter:java -version. You should see an output confirming the OpenJDK version 11. To ensure the compiler is also working, typejavac -version.
Common Mistakes
One of the most frequent errors is forgetting to restart the Command Prompt after changing environment variables. Windows only loads the Path variable when a process starts; therefore, any terminal window open during the installation will still report that 'java' is not recognized as an internal or external command.
Another common mistake is pointing the JAVA_HOME variable to the bin folder. JAVA_HOME must point to the root directory of the JDK (the folder that contains the bin folder). If you set JAVA_HOME to C:\Java\jdk-11\bin, many Java-based applications (like IDEs or build tools) will fail to launch because they internally append /bin to the JAVA_HOME path, resulting in a non-existent path like C:\Java\jdk-11\bin\bin.
Users also occasionally confuse the JRE (Java Runtime Environment) with the JDK (Java Development Kit). If you only install the JRE, you can run Java apps, but you cannot compile them using javac. Always ensure you have downloaded the full JDK if you intend to do any development work.
Tips
If you need to switch between multiple versions of Java (e.g., switching from Java 11 to Java 17), do not delete your old installations. Instead, keep them in separate folders under C:\Java. To switch versions, simply update the JAVA_HOME variable to point to the desired version's folder and restart your terminal. This is much faster than uninstalling and reinstalling different versions.
When choosing a distribution, Eclipse Temurin (Adoptium) is highly recommended for most users because it is free, open-source, and provides TCK (Technology Compatibility Kit) certified binaries, ensuring that the build adheres strictly to the Java SE specification.
To keep your system clean, avoid leaving the JDK files in your Downloads folder. If you accidentally move the folder after setting the environment variables, Java will stop working immediately because the Path will point to a directory that no longer exists.
Troubleshooting
If the java -version command returns an error saying the command is not recognized, first check your Path variable. Ensure that %JAVA_HOME%\bin is listed. If it is, try replacing the variable with the absolute path (e.g., C:\Java\jdk-11.x.x\bin) to rule out issues with variable expansion.
If you see a version of Java that is not 11 (for example, Java 8 or Java 17), it means there is another Java installation taking precedence in your Path. Open the Path editor and move the %JAVA_HOME%\bin entry to the very top of the list. Windows searches the Path from top to bottom; the first match it finds is the one it executes.
If you encounter a "Permission Denied" error when extracting files, try running your zip utility as an Administrator or move the extraction target to a folder outside of C:\Program Files, such as a custom C:\Java folder. Windows has strict write protections on the Program Files directory that can interfere with manual installations.
If the javac command fails but java works, you likely have a JRE installed instead of a JDK. Check your installation folder; if there is no bin\javac.exe file, you must download the JDK package specifically.
Frequently Asked Questions
Is OpenJDK 11 free for commercial use?
Yes, OpenJDK is licensed under the GNU General Public License version 2 with Classpath Exception, making it free to use for both personal and commercial purposes.
What is the difference between OpenJDK and Oracle JDK?
OpenJDK is the open-source project and reference implementation. Oracle JDK is a commercial distribution based on OpenJDK that may include additional proprietary tools and different licensing terms for corporate use.
Do I need to uninstall older Java versions first?
No, you can have multiple versions of Java installed on one machine. You only need to manage which one is active by adjusting the JAVA_HOME and Path variables.
Why is Java 11 called an LTS version?
LTS stands for Long-Term Support. These versions are maintained for several years, providing security updates and stability, making them ideal for production environments compared to short-term feature releases.
Can I install OpenJDK 11 using a package manager?
Yes, you can use tools like Chocolatey or Scoop on Windows to install OpenJDK. These tools often handle the environment variable configuration automatically, though manual installation is more transparent for learning purposes.