Q1: What are JDK, JRE, and JVM, and how do they differ?

  • JVM (Java Virtual Machine): The abstract runtime engine that executes compiled Java bytecode (.class files).
  • JRE (Java Runtime Environment): Includes the JVM plus standard runtime libraries and class loaders required to execute Java programs.
  • JDK (Java Development Kit): The complete software development kit containing the JRE, compiler (javac), debugger (jdb), and development tools.
Relationship between JDK, JRE, and JVM
Compilation vs Execution Pipeline
# 1. Compiler (JDK component) produces bytecode
javac Main.java -> Main.class

# 2. Virtual Machine (JRE/JVM component) executes bytecode
java Main
💡 javac converts human-readable source code into platform-independent JVM bytecode.
Key Takeaways
  • JVM executes bytecode; JRE = JVM + Standard Libraries; JDK = JRE + Developer Tools (javac).
  • JDK is needed for writing and compiling code; JRE is sufficient for execution.
Knowledge Check

Which software distribution is strictly required on a developer machine to compile .java source files?