Oracle has already started rolling out development releases for Java 12 and the Java 11 version has been moved to stable release hence it is the right time to start trying it out. In this article, we will help you with setting up Java 11 (JDK 11) on your computer.
How to Install Java JDK 11 on Windows
You can either download the latest version of JDK 11 from the Oracle website: Oracle JDK 11 Download, but you will have to set up an Oracle account for downloading it. Or, you can download it from the Adopt Open JDK website (no login required). From the AdoptOpenJDK website, you can also download the .msi installers to set up JDK 11 automatically just like the older version.
Both of the versions are stable with Oracle's version being the latest one and AdoptOpen JDK's version being a few releases behind the latest.
Once you have downloaded the JDK 11 zip file (not the executable file, as that is paid now), follow the following steps:
-
Once you have downloaded the zip file, extract it in the folder C:\Program Files\Java and you will have a new jdk-11.x.x (some version) folder inside which we will have the /bin directory along with other directories.
-
Now we will set the PATH environment Variable:
-
Right-click on My Computer or This PC(in Windows 10+) and select the option Properties.
-
A new window with System properties will open. From the left sidebar, click on the option Advanced system settings.
-
Then click on the Environment Variables button in the bottom right corner.
-
Add the location of the bin folder of the JDK installation (for example, C:\Program Files\Java\jdk-11\bin) to the PATH variable in User Variables.
-
Setting the JAVA_HOME environment variable:
-
Under System variable, click new to add a new variable with the name JAVA_HOME or if the JAVA_HOME variable exists, select it and click on Edit to edit it.
-
Now enter the path of the JDK installation as a value for it (without the bin folder, for example, C:\Program Files\Java\jdk-11)
-
Click OK and then click on Apply changes.
-
With this Java's JDK 11 is configured on your system now you need to configure it in your IDE (Eclipse or IntelliJ) and you are all set. In case you are using Eclipse IDE, go to Window → Preferences → Java → Compiler and select 11 for the Compiler Compliance Level option, and under Window → Preferences → Java → Installed JREs, click on add and select the JDK 11 folder. Then click on Apply and close.
To see if it worked, open up the Command Prompt and type java -version
and see if it prints your newly installed JDK.
You may also like: