Learn
Start with a question
Each path begins with something you might already wonder about, and goes as deep as you like. If you are new, begin with the first one: everything else builds on it.
Begin here · about 21 minutes
What happens when you run a Java program?
Follow one small program from the text you type to the processor that runs it: the compiler, the class file, the JVM, memory, execution and garbage collection.
Start the first lessonGuides: short answers, then the whole story
Each guide answers one question simply, then in practice, then in depth, and links to the part of the machine that shows it.
- What is the JVM?The Java Virtual Machine explained at three levels: what it is, what it does when a Java program runs, and how the specification differs from HotSpot, with verified examples and sources.
- How the JVM worksFollow one Java program from source code through compilation, class loading, memory, execution and garbage collection, step by step, with real javac and javap output.
- JVM architectureThe main parts of the Java Virtual Machine: class loading, the runtime data areas, the execution engine, garbage collection, the native interface and the platform beneath, and how they connect.
- What is bytecode?What javac produces, how a class file stores bytecode and its constant pool, and how the JVM runs it, explained simply and in depth with a verified javap listing.
- How class loading worksHow the JVM finds, loads, links and initializes classes: the built-in class loaders, parent delegation and the steps defined in chapter 5 of the JVM Specification.
- Heap versus stackWhere Java objects and method calls live: the shared heap, each thread’s JVM stack and its frames, references versus objects, and the misconceptions to avoid.
- JVM stack framesWhat the JVM creates for every method call: the local variable array, the operand stack and frame data, and how bytecode uses them.
- Garbage collectionHow the JVM reclaims memory: GC roots and reachability, marking, sweeping and compaction, the difference between eligible and reclaimed objects, and HotSpot’s collectors.
- Interpreter versus JIT compilerHow HotSpot runs bytecode: the interpreter executes it first, profiling finds hot methods, and the C1 and C2 JIT compilers turn them into machine code, with real PrintCompilation output.
- HotSpot versus the JVM specificationWhat the Java Virtual Machine Specification requires and what HotSpot, the JVM in OpenJDK, chooses: the method area and Metaspace, the heap and its generations, the interpreter and the JIT.
Then follow your curiosity
In a sensible order, but take them in any order you like. Each links to what answers it today; dedicated laboratories are on their way.
2
Where do my objects and variables live?
The heap, the stack and the references between them: what
newreally does, and why two variables can share one object.- Chapter 5 of the first lesson: Memory
- Watch new Person("Alex") run, instruction by instruction
- Look inside a stack frame
- The heap on the map
Coming later: Memory Lab: step through your own code (M4)
3
How does Java find and load my classes?
Class loaders, the class path and the order of loading, linking and initialization, including the parts that wait until a name is first used.
- Chapter 4 of the first lesson: Loading classes
- Watch the JVM start and load your first class
- The class loader subsystem on the map
Coming later: Class Loader Explorer: a delegation simulator (M3)
4
How does the JVM run my code, and why does it get faster?
The interpreter, the JIT compilers and the code cache: why Java starts quickly and then speeds up while it runs.
- Chapter 6 of the first lesson: Execution
- Watch a hot method become machine code
- Look inside the interpreter
Coming later: Bytecode Explorer: real javap output, step by step (M5)
5
What happens to objects I stop using?
Reachability, garbage collection and HotSpot’s collectors: the difference between unreachable and actually reclaimed.
- Chapter 7 of the first lesson: Garbage collection
- Watch a young collection, with real G1 log lines
- The garbage collector on the map
Coming later: Garbage Collection Lab: collectors side by side (M6)
6
How does Java talk to code written in C?
Native methods, JNI and native libraries, and the newer Foreign Function & Memory API.
7
How do threads share work safely?
What each thread owns, what all threads share, and why shared objects need synchronization.
Coming later: Concurrency Lab: interleave two threads (M7)
8
How do ArrayList and HashMap work inside?
Arrays, buckets, hashing and resizing: what your collections do with memory.
Coming later: Collections Explorer: HashMap buckets and resizing (M7)
Your progress
Stored only in this browser.
- First lesson
- 0 / 7 chapters
- Parts of the JVM explored
- 0 / 66
- Marked as understood
- 0
The full curriculum, by subject
For readers who prefer to work through the JVM topic by topic. Laboratories are released one milestone at a time and are linked only once they work.
JVM anatomical architecture
AvailableEvery subsystem of the JVM on one interactive plate: class loading, runtime data areas, the execution engine, the garbage collector and JNI, with dissections and execution walkthroughs.
Java execution lifecycle
In development · M3From a
.javafile to instructions on the CPU: compilation, class files, JVM start-up, class loading, linking, initialization, interpretation and JIT compilation.Class Loader Explorer
In development · M3A delegation simulator and a step-by-step walkthrough of loading, linking (verification, preparation, resolution) and initialization.
Memory anatomy and laboratory
In development · M4Stack versus heap, references, object layout, generations, Metaspace, native and direct memory, and the errors that come with them.
Bytecode and the execution engine
In development · M5Source-to-bytecode comparisons from verified javap output, with the operand stack and local variables at every instruction; interpreter and JIT internals.
Garbage collection laboratory
In development · M6Build object graphs, cut references, watch reachability change and run a simulated collection; then compare G1, ZGC and Shenandoah.
Concurrency laboratory
In development · M7Two threads, one shared counter: reorder their steps and watch lost updates appear, then fix them with synchronization.
Collections anatomy
In development · M7The real internal structures of ArrayList, LinkedList, HashMap, HashSet, TreeMap, PriorityQueue and ConcurrentHashMap (JDK 25).
Java language internals
In development · M8How language features become JVM constructs: dispatch, generics and erasure, reflection and proxies, annotations, lambdas and invokedynamic, records, sealed classes and modules.
I/O and NIO
In development · M8Streams, readers and buffers down to system calls; channels, selectors, ByteBuffer and memory-mapped files.
JVM performance engineering
In development · M8Measuring before tuning: JFR and JMC, JMH, thread and heap dumps, GC logs, profiling, flags and heap sizing.
Operating system foundations
In development · M8The OS concepts needed to understand the JVM, kept clearly separate from JVM concepts.
JNI and native integration
In development · M8Native methods, native memory, the Foreign Function & Memory API and the life cycle of native resources.