Home » Core Java » Download and Install Java Development Kit (JDK) 13

About Reshma Sathe

I am a recent Master of Computer Science degree graduate from the University Of Illinois at Urbana-Champaign.I have previously worked as a Software Engineer with projects ranging from production support to programming and software engineering.I am currently working on self-driven projects in Java, Python and Angular and also exploring other frontend and backend technologies.

Download and Install Java Development Kit (JDK) 13

In this article, we will see how to download and install Java Development Kit 13, which is a non-LTS version for a Windows system.

You can also check how to install Java in the following video:

How to Install Java – video

1. Introduction

Java was first released in 1996 and since then has become one of the most widely used object-oriented programming languages. The most recent version of Java is 15 with Java 16 in the works. In this article, we will download and install Java 13 which is a Non-LTS version.

1.1 What is a Non-LTS version?

  • Starting Java version 8, Oracle has shifted its release timeline and the licenses under which Java is available. Java is now available under the 2 licenses.
    1. GNU General Public License v2 with Classpath exception (GPLv2+CPE) which is provided by OpenJDK builds.
    2. 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”.
  • Oracle has shifted from the 2-3 year release cycle to a 6-month cycle. This helps release changes/features faster and in an easy-to-adopt way.
  • Oracle will provide Long-term support(8 years or more) for a few versions called Long-Term Support(LTS) versions. Java 11 is the current LTS version. The next expected LTS version is Java 17.
  • All the versions in between, including Java 13, are non-LTS versions for which Oracle will not provide extended support.
  • More information about release cadence and licensing changes is available here.

2. Download and Install Java Development Kit 13

Depending upon the license you want to choose, there are 2 sites from where we can download Java. Oracle JDK is the enterprise version and the OpenJDK which is the open-source version. We will look at how to download and install Java JDK 13 from both.

2.1 Oracle JDK

The Oracle JDK is available under the Oracle Technology Network License Agreement (ONTLA) license and is the commercial version(Users and organizations can buy a subscription to get support from Oracle for the Java installation).

2.1.1 Download

  • Java JDK 13 has now been superseded by Java 14 and 15. Hence to download Java 13, we need to go to the Java SE 13 Archive Downloads page.
  • On the Archive-Downloads page, scroll down to find the Windows x64 Installer and click on the executable file to download.
  • Login to your Oracle account and accept the license agreement. If you do not have an account, creating one is a simple and free-of-cost process.
  • The file downloaded is: jdk-13.0.2_windows-x64_bin.exe
Java Development Kit - Oracle Java JDK 13 downloads page
Oracle Java JDK 13 downloads page

2.1.2 Install

To install Java, click on the executable jdk-13.0.2_windows-x64_bin.exe that gets downloaded on your system. Follow the steps in the executable to install java on your system.

Java Development Kit - Oracle Java JDK Installation steps
Oracle Java JDK Installation steps

2.2 OpenJDK

The OpenJDK JDK is available under the GPLv2+CPE license and is the open-source version. Oracle does not provide commercial (subscription-based) support for the OpenJDK java distributions.

2.2.1 Download

  • The latest version of java is java 15 and so to download JDK 13 we need to go to the Archived Release page.
  • Scroll down to the 13.0.2 build and click on the zip file for Windows.
  • The file downloaded is: openjdk-13.0.2_windows-x64_bin.zip
Java Development Kit - OpenJDK Archive Downloads page
OpenJDK Archive Downloads page

2.2.2 Install

To install the jdk , just extract the .zip file in the folder of your choice.

3. PATH Variable

After Java is installed, it is advisable to set the PATH variable with the path to the Java executables. Doing so enables java to be recognized across the system. There are 2 ways to set the path variable.

3.1 Command Prompt(cmd)

To set the PATH variable using cmd, Open cmd in the “Administrator” mode. Type the following commands and hit Enter.

Oracle JDK:

setx path “%PATH%; C:\Program Files\Java\jdk-13.0.2\bin”

Open JDK: (path to the oracle jdk extracted folder)

setx path "%PATH%;D:\Java\openjdk-13.0.2_windows-x64_bin\jdk-13.0.2\bin"

Java Development Kit - Setting the PATH variable through the Command Prompt
Setting the PATH variable through the Command Prompt

3.2 Environmental variables

We can also set the path variable by using the environmental variables dialog.

  • In the “Type here to Search” box type in environment variables.
  • Click on the first option. This opens the System variables screen.
  • Click on the Environment variables button. This opens the environment variables dialog box.
  • Click on the PATH variables and then click on the Edit button.
  • In the dialog box that opens, put in the Java executable path and then click on OK.

Oracle Java Development Kit:

Setting the Oracle JDK PATH through Environment variables
Setting the Oracle JDK PATH

OpenJDK Path

Setting the OpenJDK  PATH through Environment variables
Setting the OpenJDK PATH through Environment variables

4. Verifying the installation

There are 3 ways to verify that java is installed correctly.

4.1 java -version command

If the Java is installed and the PATH is set correctly, the java -version command should output the java JDK information along with the java version.

Command:

 java -version 
Java -Version output
Java Version

4.2 where command

If the Java is installed and the PATH is set correctly, the where the command outputs all the java executables present on the system.

Command to type:

where java
Where java output
Where java output

4.3 Checking the installed folders/files

Alternatively, we can also check the installed files/folders

  • For the Oracle JDK installation type “Programs” in the Type here to search box and then select the first option. This opens the “Apps and Features” dialog box. In the search box type in Java and this should output the Java version we just installed.
  • For the Open JDK, navigate to the extracted folder. Check if there is a bin folder with the java executables in it.
java installation
Java installation

5. Example Program

To ensure that Java 13 is installed and running correctly, we will compile and run a program that uses one of the preview features of Java 13 called text blocks. To learn more about JEP 355. This feature is especially useful for building Html and JSON strings in java.

In MultiLineStringsClass.java we will build a json-array using multi-line string block and display the same.

In the Pre-Java-13 code we would build a json-array as follows

String jsonString ="[{\n" +
			  "   \"quote\":\"To be, or not to be: that is the question\",\n" +
			  "   \"work\":\"Hamlet,Act 3,Scene 1\",\n" +
              "},\n" + 
              "{\n" +
			  "   \"quote\":\"All the world’s a stage, and all the men and women merely players. They have their exits and their entrances; And one man in his time plays many parts.\",\n" +
			  "   \"work\":\"As you like it,Act 2,Scene 7\",\n" +
              "},\n"+
              "{\n" +
			  "   \"quote\":\"Now is the winter of our discontent\",\n" +
			  "   \"work\":\"Richard III,Act I, Scene 1\",\n" +
              "}]\n";

Now Java 13 onwards, using the JEP355 feature we can write:

String jsonMultiLine = """
          [{
              "quote":"To be, or not to be: that is the question",
              "work":"Hamlet,Act 3,Scene 1"
          },
          {
            "quote":"All the world’s a stage, and all the men and women merely players. They have their exits and their entrances; And one man in his time plays many parts.",
            "work":"As you like it,Act 2,Scene 7"
          },
          {
             "quote":"Now is the winter of our discontent",
             "work":"Richard III,Act I, Scene 1"
          }]""";

The full source code is given below.

MultiLineStringsClass.java
public class MultiLineStringsClass{

    public static void main(String[] args) {

        //Legacy or Pre-java-13 code
        /*
        String jsonString ="[{\n" +
			  "   \"quote\":\"To be, or not to be: that is the question\",\n" +
			  "   \"work\":\"Hamlet,Act 3,Scene 1\",\n" +
              "},\n" + 
              "{\n" +
			  "   \"quote\":\"All the world’s a stage, and all the men and women merely players. They have their exits and their entrances; And one man in his time plays many parts.\",\n" +
			  "   \"work\":\"As you like it,Act 2,Scene 7\",\n" +
              "},\n"+
              "{\n" +
			  "   \"quote\":\"Now is the winter of our discontent\",\n" +
			  "   \"work\":\"Richard III,Act I, Scene 1\",\n" +
              "}]\n";
        */   

        //Java 13 JEP-355 Text Blocks syntax

          String jsonMultiLine = """
          [{
              "quote":"To be, or not to be: that is the question",
              "work":"Hamlet,Act 3,Scene 1"
          },
          {
            "quote":"All the world’s a stage, and all the men and women merely players. They have their exits and their entrances; And one man in his time plays many parts.",
            "work":"As you like it,Act 2,Scene 7"
          },
          {
             "quote":"Now is the winter of our discontent",
             "work":"Richard III,Act I, Scene 1"
          }]""";
              
        System.out.println("This is the NEW way of implementing json.");
        System.out.println(jsonMultiLine);

    }

}

To compile and run the program in command prompt with preview features enabled, we need to type in the following commands

Compile:

javac --release 13 --enable-preview MultiLineStringsClass.java

Run:

java --enable-preview MultiLineStringsClass
Java Development Kit - Example Java Program
Example Java Program

6. Summary

The general opinion in the Java Developer community on upgrading to Java 13 is that developers should update to Java 13 on their systems and test their applications for compatibility with the newer features. This would greatly help transition to the next version when the next version is released. It is however not a good idea to put Java 13 in production since it is a non-LTS version.

8. Download the Source Code

You can download the full source code of this example here: Download and Install Java Development Kit (JDK) 13

Last updated on Apr. 28th, 2021

Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!

 

1. JPA Mini Book

2. JVM Troubleshooting Guide

3. JUnit Tutorial for Unit Testing

4. Java Annotations Tutorial

5. Java Interview Questions

6. Spring Interview Questions

7. Android UI Design

 

and many more ....

 

Receive Java & Developer job alerts in your Area

 

Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments