Explains all the steps required to install OpenJDK 13 on Windows and getting started with Java using Hello World example.

How To Install OpenJDK 13 On Windows
How To Install OpenJDK 13 On Windows
September 18, 2019

This tutorial explains all the steps required to install OpenJDK 13 on Windows 10. The steps to install OpenJDK 13 on other versions of Windows should be similar to the steps explained in this tutorial.

You can also follow the steps to install How To Install VSCode For Java On Windows, How To Install IntelliJ IDEA for Java on Windows, and How To Install Eclipse for Java on Windows published by Tutorials24x7. You can also follow the How To Install OpenJDK 13 On Ubuntu to install the latest OpenJDK on Ubuntu and How To Install Java 13 On Windows to install Oracle JDK.

Notes: You may follow What's New In Java 13 to know about the new features introduced in JDK 13.

Download OpenJDK

Open the JDK 13 GA Release site and download the distribution for Windows as highlighted in Fig 1.

OpenJDK 13 Download

Fig 1

Click on the zip download link to download OpenJDK for Windows. Also, verify your download using the given sha256 checksum.

Install OpenJDK

Extract the downloaded zip to the desired location. In my case, I have extracted the downloaded zip to C:\java\java-13. The zip extractor will extract the files to C:\java\java-13\jdk-13.

This is only step required to install OpenJDK on windows.

Set Environment Variables

In this step, we will configure the environment variables in order to use the OpenJDK from Command Prompt. Open Command Prompt and check the installed version of Java using the command java -version as shown in Fig 2.

Check Java Version

Fig 2

It shows the version of Java 8 since my current version of Java is 8. In your case it might show another version of the Java if it's already installed, else it will show the message - Java is not recognized as internal or external command, operable program or batch file.

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

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

Advanced System Settings

Fig 3

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

Click on New Button and add the path to installed JDK bin which is C:\java\java-13\jdk-13\bin in our case. It should look like the one shown in Fig 4.

OpenJDK 13 Environment Variable

Fig 4

Press OK Button 3 times to close all the windows. This sets the JDK 13 on system environment variables to access the same from the console.

Notes: Remove existing PATH values specific to previously installed Java. Also update JAVA_HOME, in case it was already set.

Now again open the console and test the Java version as shown in Fig 5. Make sure to use a new console to test the version.

OpenJDK 13 Version

Fig 5

It must show the OpenJDK version as shown in Fig 5. You might need to restart the system in case it does not reflect the JDK version installed by us.

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 OpenJDK on Windows and write and execute the Java program.

Write a Comment

Click on the captcha image to get new code.
Discussion Forum by DISQUS