Paramclasses Academy - Blog

Tutorials Details

Difference Between JDK, JRE and JVM Explained with Examples

Difference Between JDK, JRE and JVM Explained with Examples

October 21, 2026

Introduction

When you start learning Java programming, you will frequently encounter three important terms: JDK, JRE and JVM.

These three components are related, but they do different jobs. The JDK provides tools for developing Java applications, the JRE is the traditional name for the environment needed to run Java applications, and the JVM executes Java bytecode.

Understanding the difference between JDK, JRE and JVM is important for beginners because it explains how Java programs are compiled and executed.

In this tutorial, we will learn their meanings, features, differences, working process and practical examples.

What Is JVM in Java?

JVM stands for Java Virtual Machine.

It is an abstract computing machine that executes Java bytecode. It provides the runtime environment in which Java classes are loaded and executed.

When you compile a Java program, the Java compiler generates bytecode in a .class file. The JVM loads that bytecode and executes it on the current platform.

Main Functions of JVM

  • Loads compiled Java classes.

  • Verifies bytecode before execution.

  • Executes bytecode using interpretation and, where appropriate, Just-In-Time (JIT) compilation.

  • Manages memory for Java objects.

  • Performs garbage collection.

  • Provides runtime services and security-related checks.

Example of JVM

Suppose you write the following Java program:

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

Save the file as Main.java.

Compile it using:

javac Main.java

This creates a compiled file named Main.class.

Now execute the program:

java Main

Output:

Hello, Java!

The JVM is responsible for executing the compiled Java bytecode when the program runs.

What Is JRE in Java?

JRE stands for Java Runtime Environment.

Traditionally, the JRE refers to the components needed to run Java applications, including the JVM and supporting runtime libraries.

A runtime environment is intended for execution rather than providing all the tools needed to develop Java programs.

Main Components of a Traditional JRE

  • JVM for executing bytecode.

  • Java runtime libraries.

  • Supporting runtime files and components.

Example of JRE

Imagine that a developer creates a Java application and distributes it to another computer.

The user does not necessarily need to compile the source code. They need a compatible Java runtime environment to execute the application.

Historically, a separate JRE installation could provide that environment.

Important: Modern Java distributions do not always provide a separate, general-purpose JRE download. Developers commonly install a JDK, and applications may also be distributed with a custom runtime image.

What Is JDK in Java?

JDK stands for Java Development Kit.

It is the software development kit used to write, compile, debug and package Java applications.

The JDK includes the Java compiler and other development tools, along with the runtime components needed to run Java programs.

Main Tools Included in the JDK

  • javac — compiles Java source code.

  • java — launches Java applications.

  • javadoc — generates documentation from source comments.

  • jar — creates and manages Java archive files.

  • jshell — provides an interactive environment for experimenting with Java code.

The exact tools and included components can vary by JDK distribution and version.

Example of JDK

Suppose you want to create a Java application from scratch.

You write source code in a .java file and use the javac compiler to turn it into bytecode. You can then run the compiled program using the Java launcher.

The JDK provides the tools required for this development process.

That is why beginners learning Core Java should generally install a JDK.

Difference Between JDK, JRE and JVM

The easiest way to understand the difference is to compare their main purposes.

Feature JDK JRE JVM
Full form Java Development Kit Java Runtime Environment Java Virtual Machine
Main purpose Develop Java applications Run Java applications Execute Java bytecode
Compiler included Yes, in a standard development JDK Not traditionally No
Runtime libraries Included as part of the Java platform Included Uses runtime libraries provided by the environment
Can execute Java programs Yes Yes, in the traditional model Executes bytecode within its runtime environment
Mainly used by Developers Application users and runtime environments The Java runtime

Easy Way to Remember

  • JDK = Develop

  • JRE = Run

  • JVM = Execute bytecode

These short definitions are useful for exams, interviews and quick revision.

Relationship Between JDK, JRE and JVM

In the traditional Java platform model, the components can be represented as follows:

JDK
 |
 +-- Development Tools
 |     |
 |     +-- javac
 |     +-- javadoc
 |     +-- jar
 |
 +-- Runtime Environment (JRE)
        |
        +-- Java Libraries
        |
        +-- JVM

This is a conceptual diagram of the traditional packaging model. Modern JDK distributions may package runtime components differently and may not include a separate JRE installation.

The important point is that the JDK provides development tools, while the JVM executes bytecode.

How Do JDK, JRE and JVM Work Together?

Let us understand the process step by step.

Step 1: Write Java Source Code

Create a file named Main.java containing your Java program.

public class Main {
    public static void main(String[] args) {
        System.out.println("Welcome to PARAM CLASSES!");
    }
}

Step 2: Compile the Program

Open a terminal in the folder containing Main.java and run:

javac Main.java

The compiler supplied by the JDK generates Main.class.

Step 3: Run the Program

Execute:

java Main

The Java launcher starts the application using the available Java runtime.

Step 4: JVM Executes the Bytecode

The JVM loads the class and executes the program.

Output:

Welcome to PARAM CLASSES!

Complete Working Flow

Main.java
    |
    v
JDK Compiler (javac)
    |
    v
Main.class (Bytecode)
    |
    v
Java Runtime
    |
    v
JVM
    |
    v
Program Output

This process illustrates how the development tools and runtime work together to execute a Java application.

Why Is Java Platform Independent?

Java is often described as a platform-independent programming language because its compiled bytecode is designed to run on compatible JVM implementations across different operating systems.

For example, a Java program compiled on Windows can often run on Linux or macOS without recompiling the source code, provided a compatible Java runtime is available and the application does not depend on platform-specific features.

The JVM itself is implemented for particular operating systems and hardware platforms.

This is the foundation of Java's famous principle: Write Once, Run Anywhere.

Difference Between JDK and JRE

The JDK and JRE serve different purposes.

The JDK provides the tools required to develop Java applications. A traditional JRE provides the components needed to execute them.

For example:

  • If you want to write and compile Java programs, install a JDK.

  • If you only need to run an application, you need an appropriate Java runtime.

  • A separate JRE installer is not available for every modern Java distribution.

Difference Between JRE and JVM

The JRE and JVM are also different.

The JVM executes bytecode, whereas the traditional JRE includes the JVM along with the runtime libraries and supporting components required to run applications.

In simple words, the JVM is one of the central components of the runtime environment, not a synonym for the entire JRE.

How to Check Java Installation

After installing a JDK, you can check your Java installation using the following commands.

Check the Java Version

java -version

This displays information about the Java runtime being used.

Check the Java Compiler Version

javac -version

This displays the version of the Java compiler.

If java works but javac is not recognized, your computer may have a runtime without the compiler, or the JDK's bin directory may not be configured correctly in your PATH.

Common Mistakes Beginners Should Avoid

  1. Thinking JDK and JVM are the same: The JDK provides development tools; the JVM executes bytecode.

  2. Thinking JRE includes the compiler: A traditional JRE is a runtime environment and does not include the development compiler.

  3. Thinking the JVM directly runs Java source code: In the conventional compilation workflow, Java source code is compiled into bytecode before execution.

  4. Assuming every JDK includes a separate JRE installation: Modern Java distributions may package runtime components differently.

  5. Confusing Java and JavaScript: They are separate programming languages.

Frequently Asked Questions (FAQs)

1. What is the full form of JDK?

JDK stands for Java Development Kit. It provides tools for developing Java applications.

2. What is the full form of JRE?

JRE stands for Java Runtime Environment. Traditionally, it provides the components needed to run Java applications.

3. What is the full form of JVM?

JVM stands for Java Virtual Machine. It executes Java bytecode.

4. Which is required to learn Java programming: JDK, JRE or JVM?

Beginners should generally install a JDK because it includes the compiler and development tools needed to write and compile Java programs.

5. Can Java run without a JVM?

In the standard JVM-based Java execution model, Java bytecode requires a compatible JVM. Other compilation approaches exist, but they are not the usual beginner workflow.

6. Does JDK include JVM?

A standard JDK distribution includes the runtime components needed to run Java applications, including a JVM implementation.

7. Is JRE available separately in modern Java versions?

It depends on the distribution. Many modern JDK distributions do not provide a separate general-purpose JRE installer, although custom runtime images can be created for applications.

8. What is the difference between JDK, JRE and JVM in one line?

JDK is for developing Java applications, JRE traditionally provides the environment to run them, and JVM executes their bytecode.

Conclusion

JDK, JRE and JVM are important parts of the Java platform, and understanding their roles makes it easier to learn how Java programs are developed and executed.

Remember these three points:

  • JDK provides development tools.

  • JRE traditionally provides the runtime environment.

  • JVM executes Java bytecode.

If you are starting Core Java, install a JDK and practise compiling and running simple programs. This will help you understand Java's compilation and execution process.