class loading
The JVM finding a class's bytecode on the class path, reading it and preparing it the first time the class is needed.
In more detail
Classes are loaded one at a time on first use, not all at startup. After loading, the bytecode is verified and the class is initialized. A class missing from the class path therefore fails when a code path first needs it, which can be minutes into a run rather than at compile time.
Related terms
- bytecode verification — The JVM's check, before running a newly loaded class, that its bytecode is well-formed and cannot break the machine's rules.
- static initializer — A block marked static inside a class that runs exactly once, the first time the class is actually used.
- class path — The list of folders and JAR files the JVM and the compiler search to find classes.
Taught in
- The Lifecycle Of A Java Program — Modern Java: Virtual Threads & High-Throughput Services