# JVM (Java Virtual Machine)

URL: https://softwaredictionary.org/terms/jvm
Category: Programming Languages
Last updated: 2026-10-05
Pronunciation: jay-vee-EM

In short: The JVM runs Java bytecode, so the same compiled program works on any operating system; Kotlin, Scala and Clojure compile to that bytecode too.

## What is the JVM?

Java source code isn't compiled for a particular processor. The `javac` compiler turns it into bytecode, stored in `.class` files and packaged in JAR files, and the JVM runs that bytecode on whatever machine it is installed on. That is the idea behind Java's old slogan, write once, run anywhere: the program is the same on Windows, macOS and Linux, and only the JVM differs.

The JVM does much more than read bytecode. It loads classes as they are needed, checks the bytecode for safety, manages memory with a garbage collector, and compiles the most frequently run code into native machine code with a just-in-time (JIT) compiler, which is why long-running Java servers get faster after they warm up. HotSpot, the most widely used implementation, comes with OpenJDK, the open-source project behind most Java distributions.

Because the JVM runs bytecode rather than Java itself, other languages target it too: Kotlin, Scala, Clojure and Groovy compile to the same bytecode and can use any Java library. To develop, you install a JDK (Java Development Kit), which includes the compiler and the JVM. The JVM's specification is public, so several vendors build their own distributions of it.

## Key takeaways

- The JVM runs Java bytecode, so a compiled program works on any operating system.
- It manages memory with a garbage collector and speeds up hot code with a JIT compiler.
- Kotlin, Scala, Clojure and Groovy also compile to JVM bytecode.
- A JDK contains the compiler and the JVM; HotSpot, from OpenJDK, is the usual JVM.

## Example: From source code to bytecode to the JVM

```bash
# Hello.java: public class Hello { public static void main(String[] a) { System.out.println("Hi"); } }
javac Hello.java   # compile to bytecode: Hello.class
java Hello         # the JVM loads Hello.class and runs it
# Hi
javap -c Hello     # print the bytecode instructions the JVM executes
```

## Frequently asked questions

**What is the difference between the JDK, the JRE and the JVM?**

The JVM is the engine that runs bytecode. The JRE was the JVM plus the standard library, enough to run programs. The JDK adds the development tools, such as the `javac` compiler. Since Java 11, Oracle no longer ships a separate JRE, and you install a JDK.

**Is the JVM the same kind of virtual machine as VirtualBox?**

No. A system virtual machine imitates a whole computer so it can run an operating system. The JVM is a process virtual machine: an ordinary program that runs one application's bytecode.

## Sources

- [The Java Virtual Machine Specification (Java SE 21)](https://docs.oracle.com/javase/specs/jvms/se21/html/index.html)
- [Oracle: Java Virtual Machine Technology Overview](https://docs.oracle.com/en/java/javase/21/vm/java-virtual-machine-technology-overview.html)

---

Software Dictionary: https://softwaredictionary.org/ · https://softwaredictionary.org/llms.txt
