🧠 Java Quiz

JVM, JDK & JRE

Three letters that confuse every beginner. Let's clear them up in 5 minutes.

The big picture

When you "install Java", you're really installing a platform — a stack of three nested components. From outermost to innermost:

The JDK contains the JRE, and the JRE contains the JVM. Like Russian nesting dolls.

JVM — Java Virtual Machine

The JVM is the actual engine that runs Java code. When you compile Java source (.java) you don't get a native executable — you get bytecode (.class files). The JVM reads bytecode and executes it on whatever operating system it's running on.

This is the magic of "write once, run anywhere": the same bytecode runs on Windows, macOS, Linux, Android — because each platform has its own JVM that knows how to translate bytecode into native instructions.

Modern detail Today's JVM uses Just-In-Time (JIT) compilation — frequently-executed bytecode gets compiled to native machine code on the fly, often matching C++ in performance.

JRE — Java Runtime Environment

The JRE is the JVM plus the standard libraries (the java.* packages). It's what you need to run Java applications, but not to write them.

If you're just running a banking app or a Minecraft server written in Java, the JRE is enough.

JDK — Java Development Kit

The JDK is the JRE plus developer tools — the compiler (javac), debugger (jdb), packaging tools, documentation generator, and more. If you're learning Java or writing code, you want the JDK.

Compilation flow

From source to running program
  Hello.java     ← your source code
       │
       │  javac  (compiler — part of JDK)
       ▼
  Hello.class    ← bytecode (platform-independent)
       │
       │  java  (launcher — runs the JVM)
       ▼
  JVM executes
       │
       ▼
  Native machine instructions  ← JIT-compiled at runtime

Which one do you need?

Picking a version

Java has Long-Term Support (LTS) releases every 2–3 years. As of 2026, the current LTS versions are Java 21 and Java 17. Both are excellent choices for new projects. Stick to LTS for production work — non-LTS versions stop receiving updates after 6 months.

Quick rule For learning: install the latest LTS JDK (Java 21 right now). It has all the modern features (records, switch expressions, pattern matching) and you'll be using it for years.