Java Virtual Machine
Also known as:
JVM
Java VM
HotSpot
Definition
The Java Virtual Machine, or JVM, is the runtime engine that executes Java bytecode. When you compile Java source with javac you get .class files of portable bytecode, and the JVM loads, verifies, and runs that bytecode on any platform. It manages memory automatically through garbage collection and speeds up hot code with a Just-In-Time compiler. Because a JVM exists for every major operating system, the same bytecode runs unchanged everywhere, which is Java’s Write Once, Run Anywhere promise.
Popular reads
View All
Cursor Skills: How to Create and Use Agent Skills
Jun 23, 2026
Payment System Design: Ledger, Idempotency, and Settlement
Jul 18, 2026
X Algorithm Explained: How the Open Source Recommendation System Works
Jan 22, 2026
Complete Guide to Graph Data Structure: BFS, DFS, Adjacency List vs Matrix
Jan 20, 2026
The Complete HTMX Guide: From Zero to Production
Dec 22, 2025
Transactional Outbox Pattern: Never Lose an Event Again
Apr 07, 2026
Key Takeaways
- The JVM runs bytecode, not source.
javaccompiles.javato.class, and the JVM executes the.class. - It has three subsystems: the class loader, the runtime data areas (heap, stacks, method area), and the execution engine (interpreter, JIT compiler, and garbage collector).
- Execution is hybrid: the interpreter starts fast, then the JIT recompiles hot methods to native machine code.
- The JVM is not the same as the JDK or JRE. The JVM runs code, the JRE adds core libraries, and the JDK adds developer tools like
javac.
How It Works
- The class loader loads, links, and initializes classes into memory on first use.
- The JVM lays out runtime data areas: a shared heap for objects and a private stack per thread.
- The execution engine interprets bytecode and profiles the program as it runs.
- Hot methods are JIT-compiled to native code, while the garbage collector reclaims unreachable objects.
Where It Is Used
- HotSpot is the reference JVM shipped in OpenJDK and Oracle JDK, used by most Java applications in production.
- Languages like Kotlin, Scala, and Clojure compile to JVM bytecode and run on the same engine.
- GraalVM offers an alternative JVM plus ahead-of-time native image compilation for fast startup.