# Java Virtual Machine (JVM)

> The runtime that runs Java bytecode. It works on any machine that has one.

**Field:** Software Development  
**Category:** Compilers & Runtimes  
**Also known as:** JVM, Java VM

## Think of it like

It is like a game box for the TV. A game made for it plays on every box like it.

## Definition

The Java Virtual Machine, or JVM, is the runtime that runs Java programs. The Java compiler turns code into bytecode, kept in .class files. The JVM runs that bytecode on any computer that has a JVM. It turns busy code into machine code as it runs. It also cleans up memory for you. Kotlin, Scala and Clojure make bytecode for the JVM too.

## Example

Lucy builds a Java app once. The same .jar file runs on her Windows laptop and on a Linux server, each with its own JVM.

## Example code

```console
$ javac Hello.java
$ java Hello
Hello, world!
```

javac makes the bytecode. The java command starts a JVM to run it.

## Why it matters

It is why one Java build runs on many systems. Many large websites and company systems run on it.

## Common mistake

Thinking the JVM runs only Java. It runs any language that compiles to its bytecode, like Kotlin.

## Three principles

- **Runs bytecode.** Not Java source code itself.
- **Many systems.** One build, any machine with a JVM.
- **Many languages.** Kotlin and Scala use it too.

## Related terms

- [Runtime Environment](https://learn.benibix.com/term/development/runtime-environment)
- [Java](https://learn.benibix.com/term/development/java)
- [Bytecode](https://learn.benibix.com/term/development/bytecode)
- [Just-in-Time Compilation (JIT)](https://learn.benibix.com/term/development/just-in-time-compilation)
- [Garbage Collection](https://learn.benibix.com/term/development/garbage-collection)
- [Kotlin](https://learn.benibix.com/term/development/kotlin)
- [Common Language Runtime (CLR)](https://learn.benibix.com/term/development/common-language-runtime)

## Told apart from

- [JVM vs CLR](https://learn.benibix.com/compare/jvm-vs-clr): Both run code that was first turned into an in-between form. The JVM runs bytecode made from Java and Kotlin. The CLR runs CIL made from C# and F#.
- [JVM vs Virtual Machine](https://learn.benibix.com/compare/jvm-vs-virtual-machine): A virtual machine in the cloud acts like a whole computer and runs a full system. The JVM is just a program. It only runs Java bytecode.

![Source code splits into two paths. On the top path, a compiler turns C code into an executable file of machine code, which the operating system runs straight away. On the bottom path, a compiler turns Java or C# code into bytecode, and a runtime, the JVM or the CLR, turns that into machine code while the program runs.](https://learn.benibix.com/diagrams/dev7-runtimes.svg)

---

Source: https://learn.benibix.com/term/development/java-virtual-machine
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
