This content originally appeared on DEV Community and was authored by Ligouri S Tittus
JVM (Java Virtual Machine)
- It is the engine that runs Java programs.
- Converts bytecode into machine code (so your OS can understand).
- Platform-dependent (Windows JVM ≠ Linux JVM), but bytecode is the same.
- Responsible for memory management & garbage collection.
JRE (Java Runtime Environment)
- It provides everything needed to run a Java program.
- Contains JVM + libraries + classes (but not development tools).
- If you only want to run Java apps (not develop them), install JRE.
JDK (Java Development Kit)
- It is used by developers to write and run Java code.
- Contains JRE + development tools like compiler (javac), debugger, etc.
- Needed if you want to develop Java applications.
EXAMPLE
Just by understanding Example:
Imagine Java is like watching and making movies:
JVM → The screen/projector that plays the movie.
JRE → The DVD player + required software to watch movies.
JDK → The camera and editing tools to create the movie.
How it Works:
JDK → For Developers (write & run programs)
JRE → For Users (just run programs)
JVM → For Machines (executes the code)
This content originally appeared on DEV Community and was authored by Ligouri S Tittus