What Is JDK?

JDK stands for Java Development Kit. It is a collection of software tools required to develop, compile, test, debug, and run Java applications. If you want to write Java programs on your computer, the JDK is the main Java package you install as a developer.

The JDK contains the Java compiler, development tools, runtime components, and other utilities needed throughout the Java development process. It is designed primarily for developers rather than just users who only need to run Java applications.

Why Is JDK Needed?

When you write Java code, the computer cannot directly execute the .java source file. The source code must first be compiled into Java bytecode.

The JDK provides the tools required for this process.

The basic flow is:

Java Source Code
      ↓
     JDK
      ↓
Java Compiler (javac)
      ↓
   Bytecode
   (.class)
      ↓
     JVM
      ↓
Program Execution

For example, consider this Java program:

public class Hello {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}

Save it as:

Hello.java

You can compile it using the JDK’s Java compiler:

javac Hello.java

This produces:

Hello.class

You can then run the compiled program using:

java Hello

What Does the JDK Contain?

The JDK includes several important tools used by Java developers.

Java Compiler

The javac command is the Java compiler. It converts Java source code into bytecode.

javac Hello.java

The resulting .class file contains bytecode that can be executed by a compatible JVM.

Java Launcher

The java command starts a Java application and launches the JVM required to execute the program.

java Hello

JAR Tool

The jar command is used to create and manage Java Archive files.

JAR files can package compiled classes, resources, and metadata into a single file.

jar --create --file app.jar Hello.class

Javadoc

javadoc generates HTML documentation from documentation comments written in Java source code.

For example:

/**
 * Calculates the total price.
 */
public double calculateTotal() {
    return 100.0;
}

Javadoc can turn these comments into structured documentation.

JShell

JShell is an interactive Java shell that allows developers to test Java expressions and small pieces of code without creating a complete Java class.

For example:

jshell> int x = 10
x ==> 10

jshell> x * 2
$2 ==> 20

It is particularly useful when learning Java or quickly testing an idea.

Debugging Tools

The JDK also provides tools and technologies that help developers find and investigate problems in Java applications.

Modern JDK distributions include various diagnostic and monitoring utilities in addition to the core compiler and launcher.

JDK and JVM

The JDK and JVM are related but they are not the same thing.

The JDK is a development kit, while the JVM is the runtime engine that executes Java bytecode.

For example:

JDK
 ├── Java Compiler
 ├── Development Tools
 └── Runtime Components
          ↓
         JVM
          ↓
    Executes Bytecode

A developer uses the JDK to create Java applications, while the JVM is responsible for executing the resulting bytecode.

JDK, JRE, and JVM

These three terms are commonly discussed together.

ComponentPurpose
JDKUsed to develop Java applications
JRETraditional runtime environment for running Java applications
JVMExecutes Java bytecode

A commonly used conceptual relationship is:

JDK → JRE → JVM

However, modern Java distributions have changed how these components are packaged. Since Java 11, Oracle has generally not distributed a separate JRE download, so the JRE is best understood as a traditional conceptual runtime layer rather than something you necessarily install separately.

Different JDK Distributions

The Java Development Kit is available from several vendors and projects. Examples include:

  • Oracle JDK
  • OpenJDK
  • Eclipse Temurin
  • Amazon Corretto
  • Azul Zulu

These distributions implement the Java platform according to the relevant Java specifications, although licensing, support policies, release schedules, and additional tooling can differ.

For learning Java and development, you can choose a current long-term-support JDK from a reputable distribution.

JDK Versions

Java has had many major releases, including:

  • Java 8
  • Java 11
  • Java 17
  • Java 21
  • Java 25

Some Java releases are designated as Long-Term Support (LTS) releases and receive extended support from particular vendors.

For a new project, the appropriate JDK version depends on the project’s requirements, framework compatibility, and the support policy of the organization.

How to Check Your JDK Version

After installing a JDK, you can check the installed Java version using:

java -version

You can also check the compiler version:

javac -version

For example, the output might look similar to:

java version "21"
javac 21

The exact output depends on the JDK distribution and version installed.

Why Is JDK Important for Java Developers?

The JDK is the foundation of the Java development environment. Without the appropriate development tools, you cannot normally compile Java source code into bytecode or use many of the utilities required for professional Java development.

Whether you are creating a simple console application, a Spring Boot backend, or a large enterprise system, the development process ultimately relies on a Java development kit.

FAQs

What is JDK in simple words?

JDK is a collection of tools that allows developers to create, compile, test, debug, and run Java applications.

Is JDK required to run Java programs?

A JDK is required when you need to develop and compile Java programs. A separate development kit is not necessarily required just to run an already compiled application.

What is the difference between JDK and JVM?

The JDK provides development tools such as javac, while the JVM is responsible for executing Java bytecode.

Which JDK should I install?

For learning and development, choose a current supported JDK, preferably an LTS release when your project does not require a specific version.

Is OpenJDK free?

OpenJDK refers to the open-source Java development project. Specific JDK distributions can have different licensing and support terms, so check the distribution’s licensing and support policy