Skip to content
BENIBIX Learn

Java Virtual Machine (JVM)

Development⚙️ Compilers & RuntimesRuntimes

Also known as JVM, Java VM

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

Think of it like

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

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.

Why it matters

It is why one Java build runs on many systems. Many large websites and company systems run on 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 code

console
$ javac Hello.java
$ java Hello
Hello, world!
javac makes the bytecode. The java command starts a JVM to run it.
The JVM sits on the bottom path. It turns Java bytecode into machine code as the program runs.

Common mistake

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

Key takeaways

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

Compare