Download and Install Java Development Kit (JDK) 11
In this article, we will see how to download, install, and run Java JDK 11 which is an LTS (Long term support) version on a Windows 10 operating system.
You can learn more about Java 11 through our Java 11 New Features Tutorial.
1. Introduction
Java is an extremely popular object-oriented programming language. The first version of java (1.0) was released in 1996. Since then it has undergone radical changes. The current version of Java is Java 14 and Java 15 is scheduled to be released soon.
1.1 What is JDK?
JDK stands for Java Development Kit. The Java development kit contains the environment to develop and execute (run) a Java application. It is a package that comes with the development tools and the JRE(Java Runtime environment).
1.2 What is Long Term support version?
To understand what Long-term support version means, we first must understand the new Java Licensing rules.
1.2.1 Before Java 11
Before Java 11, Java used the Binary Code License (BCL). This enabled most users (including commercial) to used Java for free. There was also a paid version with the same license where users could use certain features of Java-like Java Mission Control, Java Flight recorder, etc that were not included in the “free” build.
Starting Java 9 onwards, Java is provided under 2 licenses:
- GNU General Public License v2 with Classpath exception (GPLv2+CPE) which is provided by OpenJDK builds.
- The commercial license under Oracle product or service i.e. Oracle Technology Network License Agreement (ONTLA). Users can still this version for free if they use it for personal use. For Production use, the organizations will need to pay for “Java SE subscriptions”. Complete details related to the subscriptions and rules are available here.
Starting from JDK 11, the OpenJDK and the Oracle licensed versions will be identical.
1.2.2 Long-term Support
Oracle has shifted from the 2-year cycle to a 6-month release cycle to keep up with demands in the technology world. From here on, Oracle would be providing extended support only for long term versions (Java 11 is the latest long term version). Support for all previous versions would be stopped for all free Java users. If commercial users want to use previous versions of java, they would need to use one of the long term versions like Java 8 or 11. They would not be able to get extended support for Java 9 or 10.
Developers who prefer rapid innovation, so that they can leverage new features in production as soon as possible, can use the most recent feature release or an update release thereof and move on to the next one when it ships.
Matt Reinhold, chief architect for Java
OpenJDK binaries become the primary channel for developers to access the latest innovation in the Java SE platform, the Oracle JDK will remain as a long term support LTS offering for Oracle’s commercial and support customers.
Donald Smith,Oracle Spokesman
2. System Requirements
After Java 9, Java runs only 64 bit OS and not 32 bit OS. All the details related to system configuration requirements are available on this page.
3. Download and Install OpenJDK 11
Open JDK version of Java that is available under the GNU General Public license with classpath exception (GPLv2+ CE).
3.1 Download OpenJDK Java JDK 11
To download visit the OpenJDK Archive Download page.
Scroll down until you find: 11.0.2 (build 11.0.2+9) and download the zip file for the 64-bit Windows version. The file that gets downloaded is openjdk-11.0.2_windows-x64_bin.zip.
3.2 Install OpenJDK Java JDK 11
Extract the downloaded zip into a directory. This will install OpenJDK Java on your system.
4. Download and Install Oracle JDK 11
The Oracle JDK is available under the Oracle Technology Network License Agreement (ONTLA).
4.1 Download Oracle Java JDK 11
To download the Java JDK 11 from the Oracle site visit the Java SE Development Kit 11 Downloads page. Scroll down to find the Windows x64 Installer and click on the executable (.exe) file. You need to accept the license agreement and login to the Oracle site. If you do not have an account, creating an Oracle account is free of cost.
Once you have logged the .exe will be downloaded. The file downloaded is jdk-11.0.8_windows-x64_bin.exe
4.2 Install Oracle Java JDK 11
To install, just click on the executable (exe) file and follow the steps. This will install Java on your system.
5. Setting the class path
We have seen how to download and install Java on a Windows system. Next, we will look at how and why to set the classpath.
5.1 Why set the Path?
Whenever Java executes or compiles a program it will access the corresponding executable file that is present in the bin folder of the java installation. If we have set the PATH variable in the System variables on our system, we would not require specifying the entire path of java executable every time.
Example: We want to compile and then execute a java file named MyClass.java
. Assume, we are using the OpenJDK java 11 and we have not set the path variable.
Then to compile MyClass.java
file, we would have to write the whole path to the javac executable as follows
D:\Java\openjdk-11.0.2_windows-x64_bin\jdk-11.0.2\bin\javac MyClass.java
Similarly, to execute we would have to write
D:\Java\openjdk-11.0.2_windows-x64_bin\jdk-11.0.2\bin\java MyClass
If instead we set the path variable, then we can simply write:
javac MyClass.java
and java MyClass
5.2 Setting the PATH variable
To set the class path from the command Prompt, open the command prompt (cmd) in the Admin mode and type:
For Open JDK:
setx path “%path%;D:\Java\openjdk-11.0.2_windows-x64_bin\jdk-11.0.2\bin"
For Oracle JDK:
setx path “%path%; C:\Program Files\Java\jdk-11.0.8\bin”
Alternatively, we can also do the following:
- In the “Type here to search” box type “Advanced system settings”.
- Click on the first option that appears
- Click on the Environment Variables which opens a new window.
- In that find the Path variable from the System Variables and click on the Edit button.
- This opens a new dialog box where we can click on the New button and add the Java path till bin.
Below are the steps above for setting Open JDK path
Below are the steps for setting the Oracle JDK path
6. Checking the Installation
Once we are done download, install and setting the path variable, we can check if java is working correctly or not. The easiest way to check that is by using the java -version command.
Assuming that java is installed correctly and the path is set,this is the output of the java -version command.
One other way to check the java installation is to use the “where” command. This gives back the folder location where the java executable is located.
7. Run a Java Program
To test whether our installation is working correctly or not, we will compile and execute a remarkably simple Java program called MyClass.java
.
The MyClass.java
simply outputs a quote by a famous person.
MyClass.java
public class MyClass{ public static void main(String[] args){ System.out.println(" "); System.out.println("If Java had true garbage collection, most programs would delete themselves upon execution - Robert Sewell"); } }
Below are the compilation and execution steps and output
8. Summary
In this article, we learned how to download, install, and run the Java JDK 11 on a Windows 10 operating system.
Before you go, you can also check our article about How to download Java 14 for Windows 10.
9. More articles
- How to update Java for Windows 10, macOS, and Android
- Download and Install Java Development Kit (JDK) 8
10. Download the Source Code
You can download the full source code of this example here: Download and Install Java Development Kit (JDK) 11
Last updated on May 03rd, 2021