class path
The list of folders and JAR files the JVM and the compiler search to find classes.
In more detail
When code refers to a class, the JVM looks for it along the class path. Build tools compute it from your dependencies: a test-scoped dependency is on the class path while tests run and absent from what ships. Spring Boot also inspects the class path to decide which auto-configuration applies.
Example
java -cp target/classes com.example.AppRelated terms
- 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.
- JAR file — A zip archive holding compiled classes and resources, plus a manifest describing them, which the JVM can load directly.
- dependency scope — A Maven setting on a dependency that says when it is on the class path, such as only while compiling and running tests.
- auto-configuration — Spring Boot's mechanism for creating infrastructure beans automatically when their libraries are on the class path and no bean of your own replaces them.
Taught in
- The Lifecycle Of A Java Program — Modern Java: Virtual Threads & High-Throughput Services
- The Toolchain: Maven — Modern Java: Virtual Threads & High-Throughput Services
- Spring Boot Auto Configuration — Modern Java: Virtual Threads & High-Throughput Services
- Modules: Exports, Opens And Services — Oracle Certified Professional: Java SE 21 Developer (1Z0-830) Exam Prep
- Jars, Automatic Modules And Runtime Images — Oracle Certified Professional: Java SE 21 Developer (1Z0-830) Exam Prep