Classpath:在 Java 等运行环境中,用来告诉编译器或 JVM(Java 虚拟机)到哪里去查找 类(.class)、包 以及相关资源(如配置文件)的路径集合。通常由一个或多个目录、JAR 文件组成。
/ˈklæsˌpæθ/
The program can’t start because the library isn’t on the classpath.
程序无法启动,因为那个库没有加入 classpath。
After adding the JAR to the classpath, the application compiled and ran successfully, even though the dependency was not installed system-wide.
把那个 JAR 加入 classpath 之后,应用就能成功编译并运行了,即使该依赖并没有在系统范围内安装。
Class + path 的合成词:class 指 Java 的“类”,path 指“路径”。随着 Java 生态中大量依赖以目录或 JAR 包形式分发,需要一种机制让编译与运行时都能定位这些类文件,于是形成了 classpath 这一术语。