About This Route

Central question: What actually happens when Java code runs on the JVM?

This route maps Java source, class files, JVM runtime structures, and observable runtime behavior. It explains how Java source becomes class files, how a JVM process turns those artifacts into runtime structures, and how memory, method execution, threads, garbage collection, JIT compilation, pauses, and diagnostics fit together.

The practical reference point is HotSpot/OpenJDK, because that is the JVM implementation most Java developers encounter.

Contents

  1. What Does It Mean for Java Code to Run on the JVM?
  2. From Java Source Code to Class Files
  3. What a Class File Contains
  4. How the java Command Starts a JVM Process
  5. Class Loading, Linking, and Initialization
  6. Runtime Data Areas: Heap, Stacks, Metaspace, and Threads
  7. Stack Frames, Local Variables, and the Operand Stack
  8. Objects, References, and Heap Allocation
  9. Method Invocation, Dynamic Dispatch, and Exceptions
  10. Threads, Monitors, and Memory Visibility
  11. Garbage Collection as Reachability and Reclamation
  12. JIT Compilation, Warmup, and Runtime Optimization
  13. Safepoints, Pauses, and Runtime Coordination
  14. Diagnosing JVM Problems: OOM, GC Logs, Stack Traces, and Thread Dumps
  15. Final Mental Model: Java Concepts and Their JVM Runtime Counterparts

Reading Path

Read the notes in order. The path starts with what it means for Java code to run, then separates source code, class files, bytecode, the JVM process, runtime memory, method execution, objects, threads, garbage collection, JIT compilation, pauses, and diagnostic artifacts.

What You Will Understand

  • Java source code is not what the JVM directly executes.
  • Class files, bytecode, runtime memory areas, stack frames, objects, and threads are distinct parts of the runtime model.
  • Garbage collection, JIT compilation, safepoints, and pauses are runtime mechanisms rather than vague JVM magic.
  • Stack traces, GC logs, thread dumps, and memory errors are useful when connected back to the structures that produced them.