What Is JDK in Java With Example: A Complete Guide

Robert Jul 13, 2026

The JDK, or Java Development Kit, is a software package from Oracle that allows developers to develop, compile, and run Java applications. It includes the Java Runtime Environment (JRE), an interpreter loader, and libraries. But what exactly is the JDK in Java, and how does it differ from the JRE? Let's dive into the details, explore its components, and even see an example of how to use it.

Java Collection Framework: ArrayList Explained Visually
Java Collection Framework: ArrayList Explained Visually

Java Development Kit (JDK) is a crucial component for Java developers. It provides the tools necessary for developing and running Java applications. But why do we need it, and what makes it different from the JRE?

β˜• Java Basics Cheat Sheet for Beginners | Learn Java in One Page πŸš€
β˜• Java Basics Cheat Sheet for Beginners | Learn Java in One Page πŸš€

Understanding the JDK

The JDK is the core of Java development. It not only includes the Java Runtime Environment (JRE), which is responsible for executing Java applications, but also contains tools essential for development, such as the javac compiler and jar packager.

JDK vs JRE vs JVM β˜• | Java Core Concepts Explained
JDK vs JRE vs JVM β˜• | Java Core Concepts Explained

So, while the JRE is a subset of the JDK, the JDK is more than just the JRE. It's an all-in-one package that enables development, compilation, and execution of Java code.

JDK Components

Differences Between JDK, JRE and JVM - GeeksforGeeks
Differences Between JDK, JRE and JVM - GeeksforGeeks

The JDK comprises several core components, each serving a specific purpose:

  • Java Runtime Environment (JRE): The execution environment for Java programs.
  • javac: The Java compiler, which converts human-readable Java source code (β€œ.java” files) into machine-readable bytecode (β€œ.class” files).
  • jar: A tool used to package related Java classes and resources into a single file (.jar) for efficient distribution.
  • javadoc: A documentation generator, used to generate API documentation in HTML format from Java source code comments.

Examples of JDK Usage

How to Work With JSON in Java?
How to Work With JSON in Java?

Let's consider a simple Java program to illustrate the use of the JDK.

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

Here's how you would compile and run this program using the JDK:

  1. Save the code above in a file named HelloWorld.java.
  2. Open a command prompt or terminal, navigate to the folder containing the file.
  3. Compile the program using the javac command: javac HelloWorld.java
  4. Run the compiled program using the java command: java HelloWorld. You should see the output: Hello, World!
Introduction to JDBC | Java Database Connectivity
Introduction to JDBC | Java Database Connectivity

The Importance of keeping your JDK updated

Just like the Java Runtime Environment (JRE), the JDK also needs to be updated to ensure it has the latest features, security patches, and performance improvements. Here's how to check and update the JDK:

Java Cheatsheet
Java Cheatsheet
JDK vs JRE vs JVM Explained | Java Programming Basics for Beginners πŸ’»
JDK vs JRE vs JVM Explained | Java Programming Basics for Beginners πŸ’»
Java Variables Explained | Local, Static & Instance Variables in Java
Java Variables Explained | Local, Static & Instance Variables in Java
What is JAVA?
What is JAVA?
Inheritance in Java Explained | OOP Concepts for Beginners
Inheritance in Java Explained | OOP Concepts for Beginners
β˜• What Is Java? | Simple Guide for Beginners πŸš€
β˜• What Is Java? | Simple Guide for Beginners πŸš€
Packages in Java Explained | Built-in & User Defined Packages
Packages in Java Explained | Built-in & User Defined Packages
10 Example of this keyword in Java
10 Example of this keyword in Java
Logical Operators in Java: Think Smarter, Code Better β˜•πŸš€
Logical Operators in Java: Think Smarter, Code Better β˜•πŸš€
Introduction to Java (Hindi) | What is Java? Explain with Syntax and Example
Introduction to Java (Hindi) | What is Java? Explain with Syntax and Example
Data Types in Java Explained | Primitive & Non-Primitive Java Data Types
Data Types in Java Explained | Primitive & Non-Primitive Java Data Types
a poster with different types of writing and numbers on it, including the words'jwa beginner notes '
a poster with different types of writing and numbers on it, including the words'jwa beginner notes '
Advanced Java (May – 2018) [IDOL: Revised Course | Question Paper]
Advanced Java (May – 2018) [IDOL: Revised Course | Question Paper]
JavaScript Basics | Chapter 1 πŸ“– | Part 1
JavaScript Basics | Chapter 1 πŸ“– | Part 1
Top Features of Java Every Beginner Should Know β˜•πŸš€
Top Features of Java Every Beginner Should Know β˜•πŸš€
Understanding JDK, JRE, and JVM in Java

If you are starting with Java development, it’s important to understand these three terms:

JDK (Java Development Kit) – Includes JRE, compiler, debugger, and other development tools.
JRE (Java Runtime Environment) – Provides JVM and class libraries required to run applications.
JVM (Java Virtual Machine) – Executes Java bytecode and makes Java platform-independent.

In simple terms:

Developers use JDK to build programs.

Applications run on JRE.

Exe... Class Library, Java Programming, Backend Developer, Java, Programming, Coding
Understanding JDK, JRE, and JVM in Java If you are starting with Java development, it’s important to understand these three terms: JDK (Java Development Kit) – Includes JRE, compiler, debugger, and other development tools. JRE (Java Runtime Environment) – Provides JVM and class libraries required to run applications. JVM (Java Virtual Machine) – Executes Java bytecode and makes Java platform-independent. In simple terms: Developers use JDK to build programs. Applications run on JRE. Exe... Class Library, Java Programming, Backend Developer, Java, Programming, Coding
πŸ–₯ JVM vs JRE vs JDK – What’s the Difference? πŸ€”
πŸ–₯ JVM vs JRE vs JDK – What’s the Difference? πŸ€”
How To Work With JSON In Java?
How To Work With JSON In Java?
Java Cheat Sheet: Operators, Scanner & User Input β˜•
Java Cheat Sheet: Operators, Scanner & User Input β˜•
Data Types in Java
Data Types in Java

Checking the JDK Version

You can check the version of your JDK using the java -version command in the terminal or command prompt.

Updating the JDK

To update the JDK, you'll need to download the new version from the Oracle website, then install it. Alternatively, you can use a package manager like apt (for Ubuntu) or brew (for macOS) to update your JDK.

In conclusion, the JDK in Java is an essential tool for Java developers. Understanding its components and how to use it is a foundational skill for any aspiring Java programmer. So, start practicing and experimenting with your JDK today!