Home »
Java
Difference Between JDK and JRE in Java
Last Updated : July 24, 2025
To develop or run Java applications, you must understand the roles of the JDK (Java Development Kit) and JRE (Java Runtime Environment). Both are essential components of the Java platform, serving different purposes for developers and users.
What is JDK?
JDK stands for Java Development Kit. It is a full-featured software development kit required to develop Java applications. The JDK includes tools to write, compile, and debug Java programs, as well as everything that is part of the JRE.
JDK = JRE (JVM + Libraries) + Development Tools
Key Components of JDK
- Java Compiler: Converts Java source code (
.java
) into bytecode (.class
).
- Java Debugger: Helps identify and fix bugs in code.
- JVM: Java Virtual Machine to execute bytecode.
- Java Libraries: A set of built-in classes and APIs used by Java programs.
JDK Example
Suppose you are a Java developer. You will use the JDK to:
- Write Java code (e.g.,
Sample.java
)
- Compile the code using
javac
to get Sample.class
- Execute the code using
java
command to see the output
public class Sample {
public static void main(String[] args) {
System.out.println("Welcome Java");
}
}
When you run the above code, the output will be:
Welcome Java
What is JRE?
JRE stands for Java Runtime Environment. It is a subset of the JDK used only to run Java applications. JRE does not include development tools such as the compiler or debugger, but it does include the JVM and standard Java class libraries.
JRE = JVM + Libraries
Key Points about JRE
- Provides the minimum environment to run Java programs.
- Used by end-users or clients who want to execute Java applications.
- Does not support writing or compiling Java code.
- JRE is a part of JDK, but JDK is not a part of JRE.
JRE Example
Suppose you are a user of a Java application. You just need JRE to:
- Run the compiled Java bytecode (e.g.,
Sample.class
)
java Sample
This will output:
Welcome Java
Difference Between JDK and JRE
Feature |
JDK |
JRE |
Stands for |
Java Development Kit |
Java Runtime Environment |
Purpose |
Used to develop and run Java applications |
Used only to run Java applications |
Includes Compiler & Tools |
Yes |
No |
Includes JVM & Libraries |
Yes |
Yes |
Who uses it? |
Developers |
End-users / Clients |
JDK and JRE Exercise
Select the correct option to complete each statement about JDK and JRE in Java.
- The JDK includes:
- Which component is enough to run a compiled Java program?
- JRE includes:
Advertisement
Advertisement