JDK, JRE, and JVM

The JVM executes Java bytecode and provides runtime services such as class loading, memory management, garbage collection, synchronization, and JIT compilation. The JDK is the developer distribution: it includes the runtime plus tools such as javac, java, jar, and diagnostic utilities.

The term JRE historically referred to a runtime distribution containing the JVM and runtime libraries. Modern JDK distributions generally provide the complete runtime image themselves, so treating "install a separate JRE" as the normal development workflow is outdated.

A useful hierarchy is:

JDK = development tools + runtime

JVM = engine that executes JVM bytecode

Java source (.java)
     |
     | javac
     v
Bytecode (.class)
     |
     | JVM class loader + verifier
     v
JVM execution engine
     |
     +--> Interpreter
     +--> JIT compiler
     +--> Garbage collector
     +--> Runtime libraries
Interview shortcut

Java source is compiled to bytecode, then the JVM can interpret and JIT-compile that bytecode at runtime.

Key Takeaways
  • javac compiles Java source into bytecode.
  • The JVM executes bytecode and may compile hot code to native instructions.
  • Modern Java development normally starts with a JDK.