Java Virtual Machine (JVM)
A free lesson from Swipe Coding · Java, level 1 · updated October 2026
By the Swipe team, founded by Colin · how we make lessons
You have learned that the compiler produces bytecode (a .class file) from your source code. But who actually executes this bytecode? The answer: the "Java Virtual Machine", or JVM for short.
The JVM is a program that runs on your operating system and reads bytecode. It translates the bytecode step by step into the machine language that your specific device's processor understands — whether that's a Windows PC, a Mac, or a Linux server.
java Main
The JVM translates ____ into machine language for the respective processor.
Every operating system has its own matching version of the JVM. This is exactly why "Write once, run anywhere" works: you write your code once, compile it once into bytecode — and it can be executed anywhere a matching JVM is installed.
Windows, macOS, and Linux each have different versions of the JVM.
The complete process looks like this: you write Main.java (source code). The compiler javac translates it into Main.class (bytecode). The JVM reads Main.class and executes it by translating it into machine language for your device.
What is the main task of the Java Virtual Machine (JVM)?
The JVM is thus the crucial link between platform-independent bytecode and the actual device your program is meant to run on. Without a JVM, no Java program could be executed.
Without an installed JVM, a device cannot execute Java bytecode files.
Keep your streak going in Swipe Coding
Swipe through every level of Java on your iPhone — with XP, stars, streaks, a personal advisor and the full track beyond these free levels.
Get the Swipe apps →