How To Install Java 20 On Windows

By bhagwatchouhan
How To Install Java 20 On Windows

This tutorial provides all the steps required to install the Oracle Java 20 officially distributed by Oracle for Windows. It provides the steps required to install Oracle JDK 20 on Windows 11. The steps should be the same for other versions of the Windows operating system.

 

Notes: The official installer provided by Oracle does not include the bundled JRE with JDK since Java 11. JRE 8 can be installed separately if required by the desktop applications. We can use Java 20 free for general-purpose computing usage. Java 20 is using the Commercial License and OpenJDK 20 is using the open-source GNU General Public License v2, with the Classpath Exception (GPLv2+CPE).

 

Java 20 is an non-LTS version which means there will be short-time support from Oracle for the same. The premier support will be available till September 2023 and extended support won't be available for Java 20.

 

You may also install the popular IDEs to develop Java applications by following - How To Install Eclipse For Java On WindowsHow To Install IntelliJ IDEA for Java on WindowsHow To Install NetBeans On Windows, and How To Install VSCode For Java On Windows.

 

Notes: The installation guide of the most recent LTS version of this tutorial is available at How To Install Java 17 On Windows.

 

Step 1 - Download JDK

 

Open the browser and search for Download JDK 20 or click the link to download from the Oracle website. It will show the JDK download page as shown in Fig 1.

 

Install JAVA SE 20 on Windows 11 - Downloads

Fig 1

 

Now click the X64 Installer link to start downloading JDK 17.

 

Step 2 - Install JDK

 

Now execute the JDK installer by double-clicking it. It might ask system permission before starting the installation. Click on yes to allow the installer to execute itself. It shows the installer welcome screen as displayed in Fig 2.

 

Install JAVA SE 20 on Windows 11 - Installation - Welcome

Fig 2

 

Click the Next Button to initiate the installation process. The next screen shows options to change the installation path. We can change the installation location on this screen if required as displayed in Fig 3.

 

Install JAVA SE 20 on Windows 11 - Installation - Path

Fig 3

 

Now click the Next Button to start the installation. It will show the progress as displayed in Fig 4.

 

Install Java 17 or JDK 17 on Windows 10 - Installation Progress

Fig 4

 

It shows the success screen after completing the installation as shown in Fig 5.

 

Install Java 17 or JDK 17 on Windows 10 - Installation Success

Fig 5

 

Now open the Command Prompt and type the command java -version to confirm whether it's installed successfully as mentioned in Fig 6.

 

Install Java 17 or JDK 17 on Windows 10 - Installation Check

Fig 6

 

It might show the message - java is not recognized as an internal or external command or show the previously installed version. In order to start using the JDK installed by us from the command prompt, we might be required to set the environment variable. You can follow the below-mentioned steps to do so.

 

Right Click -> My Computer(This PC) -> Properties -> Advanced System Settings

 

The above steps will open the Windows settings panel as shown in Fig 7.

 

Install Java 17 or JDK 17 on Windows 10 - Advanced Options

Fig 7

 

Now click the Environment Variables Button, select Path under the System Variables section, and click the Edit Button. We need to add the path of the installed JDK to the system Path.

 

Notes: The installer might add the path to System Path. We can delete it as shown in Fig 8.

 

Install Java 17 or JDK 17 on Windows 10 - Delete Path

Fig 8

 

Remove the path of the previously installed JDK. Also, update JAVA_HOME in case it's already set. Now click on New Button and add the path to the installed JDK bin which is C:\java\oracle\jdk-17\bin in my case as shown in Fig 9. Press the OK Button 3 times to close all the windows. This sets the JDK 17 on system environment variables to access the same from the console.

 

Install Java 17 or JDK 17 on Windows 10 - Configure Path

Fig 9

 

Now again open the console and test the Java version as shown in Fig 10.

 

Install Java 17 or JDK 17 on Windows 10 - Verify Installation

Fig 10

 

Getting started with Java - Hello World

 

In this step, we will write, compile, and execute our first program in Java using the standard Hello World example.

 

Now write the first Java program as shown below, save the program as HelloWorld.java and exit the editor. Make sure that the class name and file name are the same.

 

class HelloWorld {

public static void main( String[] args ) {

System.out.println( "Hello World !!\n" );
}
}

 

Now open the command prompt and navigate to the path where you have saved your Java program. Use the below-mentioned commands to compile and execute the program.

 

# Compile - Specify file name and extension
javac HelloWorld.java

# Execute - Spicy file name
java HelloWorld

# Output
Hello World !!

 

These are the easy-to-install steps required to install Oracle Java on Windows and write, compile and execute the Java program.

 

Summary

 

In this tutorial, we have discussed the steps required to install the most recent version of Java i.e. Oracle JDK 17 on Windows 10. It also provided the steps required to write, compile, and execute the HelloWorld program in Java.

share on :

Profile picture for user bhagwatchouhan
bhagwatchouhan