Differences Between JDK, JRE and JVM
Last Updated : 04 Oct, 2025
Understanding the difference between JDK, JRE, and JVM plays a vital role in understanding how Java works and how each component contributes to the development and execution of Java applications.
JDK, JRE and JVM- JDK stands for Java Development Kit. It is a set of development tools and libraries used to create Java programs. It works together with the JVM and JRE to run and build Java applications.
- JRE stands for Java Runtime Environment, and it provides an environment to run Java programs on the system. The environment includes Standard Libraries and JVM.
- JVM stands for Java Virtual Machine. It's responsible for executing the Java program.
Note: Java bytecode can run on any machine with a JVM, but JVM implementations are platform-dependent for each operating system.
JDK (Java Development Kit)
The JDK is a software development kit used to build Java applications. It contains the JRE and a set of development tools.
- Includes compiler (javac), debugger, and utilities like jar and javadoc.
- Provides the JRE, so it also allows running Java programs.
- Required by developers to write, compile, and debug code.
Components of JDK:
- JRE (JVM + libraries)
- Development tools (compiler, jar, javadoc, debugger)
Note:
- JDK is only for development (it is not needed for running Java programs)
- JDK is platform-dependent (different version for windows, Linux, macOS)
Working of JDK:
- Source Code (.java): Developer writes a Java program.
- Compilation: The JDK’s compiler (javac) converts the code into bytecode stored in .class files.
- Execution: The JVM executes the bytecode, translating it into native instructions.
JRE (Java Runtime Environment)
The JRE provides an environment to run Java programs but does not include development tools. It is intended for end-users who only need to execute applications.
- Contains the JVM and standard class libraries.
- Provides all runtime requirements for Java applications.
- Does not support compilation or debugging.
Note:
- JRE is only for running applications, not for developing them.
- It is platform-dependent (different builds for different OS).
Working of JRE:
- Class Loading: Loads compiled .class files into memory.
- Bytecode Verification: Ensures security and validity of bytecode.
- Execution: Uses the JVM (interpreter + JIT compiler) to execute instructions and make system calls.
JVM (Java Virtual Machine)
The JVM is the core execution engine of Java. It is responsible for converting bytecode into machine-specific instructions.
- Part of both JDK and JRE.
- Performs memory management and garbage collection.
- Provides portability by executing the same bytecode on different platforms.
Note:
- JVM implementations are platform-dependent.
- Bytecode is platform-independent and can run on any JVM.
- Modern JVMs rely heavily on Just-In-Time (JIT) compilation for performance.
Working of JVM:
JVM working- Loading: Class loader loads bytecode into memory.
- Linking: Performs verification, preparation, and resolution.
- Initialization: Executes class constructors and static initializers.
- Execution: Interprets or compiles bytecode into native code.
JDK vs JRE vs JVM
Aspect | JDK | JRE | JVM |
|---|
Purpose | Used to develop Java applications | Used to run Java applications | Executes Java bytecode |
|---|
Platform Dependency | Platform-dependent (OS specific) | Platform-dependent (OS specific) | JVM is OS-specific, but bytecode is platform-independent |
|---|
Includes | JRE + Development tools (javac, debugger, etc.) | JVM + Libraries (e.g., rt.jar) | ClassLoader, JIT Compiler, Garbage Collector |
|---|
Use Case | Writing and compiling Java code | Running a Java application on a system | Convert bytecode into native machine code |
|---|
Explore
Java Basics
OOP & Interfaces
Collections
Exception Handling
Java Advanced
Practice Java
My Profile