Java Interview Question

What is the difference between JDK, JRE, and JVM?

Updated 2026-08-16 · Beginner friendly
Quick answer

The JVM is the engine that runs Java bytecode. The JRE is the JVM plus the core libraries needed to run Java programs. The JDK is the JRE plus the tools needed to develop Java programs, such as the compiler. In short, JDK is for building and running, JRE is for running only, and JVM is the part that actually executes the code.

Key takeaways
  • The JVM runs Java bytecode, the JRE is the JVM plus core libraries, and the JDK is the JRE plus developer tools.
  • The JDK contains the JRE, which contains the JVM, so they nest neatly.
  • Use the JRE to run Java apps and the JDK to write and compile them.

Think of it as layers

The relationship nests neatly. The JDK contains the JRE, and the JRE contains the JVM. If you only want to run a Java app you need the JRE. If you want to write and compile one you need the JDK.

In the interview

Interviewers like the one line summary: JDK to develop, JRE to run, JVM to execute. Adding that the JDK contains the JRE which contains the JVM shows you understand how they fit together.

Frequently asked questions

What is bytecode?

Bytecode is the intermediate form Java source compiles into. The JVM translates it into machine instructions, which is what makes Java portable.

What is the just in time compiler?

The JIT compiler is part of the JVM that converts frequently used bytecode into native machine code at run time to speed up execution.

Want the full Java guide?

Read every Java concept with notes, diagrams, and code in one place. Track your progress as you go.

Open the Java guide All Java questions