Skip to content
EduVerse
JVM

JVM

In depth

Platform

Also known as: Java Virtual Machine

The virtual machine that executes Java bytecode and makes Java platform-independent: "write once, run anywhere".

JVM, explained

Written by EduVerse

What it is

The JVM (Java Virtual Machine) is the program that actually runs Java code. The compiler turns your source into bytecode, instructions for this virtual machine rather than for a specific processor, and the JVM executes it on whatever operating system it’s installed on. It also cleans up unused memory for you through garbage collection.

Why teams use it

Because each operating system has its own JVM, the same .jar file runs on Windows, macOS and Linux without recompiling. While your program runs, the JVM also compiles frequently used code to native machine code (JIT compilation). And languages like Kotlin and Scala compile to the same bytecode, so they can use the whole Java ecosystem.

An example from work

Your Spring Boot service crashes in production and the log shows java.lang.OutOfMemoryError: Java heap space. That’s the JVM saying it ran out of the memory it was allowed to use. You start by checking the -Xmx setting, which caps the heap size, or by looking for a memory leak.

Our own explanation, not a quote from the book.

In the book

Sentences from The Software Realm, Decoded that mention JVM, exactly as printed.

    1 more passages about JVM in the full book

    Read every conversation where JVM comes up, with the interactive slides and demos.

    See the book

    Where it fits

    Running Java, Kotlin, Scala and Groovy

    Coverage in the book

    In depth

    Covered in depth: multiple pages with explanations, examples and simulations.

    Appears in