JDK, JRE and JVM Architecture
Three Layers, One Stack
Java software is arranged in three related components that beginners often mix up.
JVM (Java Virtual Machine)
The JVM is a program that executes Java bytecode. It is the reason Java is portable: every operating system has its own JVM implementation, but they all obey the same specification. The JVM also manages memory and performs garbage collection.
JRE (Java Runtime Environment)
The JRE is the JVM plus the class libraries needed to run Java programs (java.lang, java.util, java.io and so on). If you only want to run a jar file, you install the JRE.
JDK (Java Development Kit)
The JDK is a superset of the JRE. It adds the tools you need to develop Java software: the javac compiler, the java launcher, jar, javadoc, and debugging tools. Modern JDKs include the JRE, so installing the JDK is all you need for both development and running.
Inside the JVM
- Class loader: loads compiled .class files into memory.
- Bytecode verifier: checks the bytecode is safe before execution.
- Execution engine: interprets and JIT-compiles bytecode to machine code for speed.
- Heap and stack: objects live on the heap, method calls and local variables live on the stack.
- Garbage collector: automatically reclaims heap memory that is no longer reachable.



- JVM runs bytecode; JRE = JVM + libraries; JDK = JRE + development tools.
- Portability comes from the JVM, not from Java itself.
- For development, always install the full JDK.