How Classes are Found

来源:互联网 发布:京东和淘宝有什么区别 编辑:程序博客网 时间:2024/05/07 14:54

来自 https://docs.oracle.com/javase/8/docs/technotes/tools/findingclasses.html

Java Launcher查找类的顺序

  • Bootstrap classes : java平台自带的类,包括rt.jar(contains all of the compiled class files for the base Java Runtime environment)与其他jre/lib目录下的jar,通过系统属性sun.boot.class.path指定这些bootstrap class的路径
  • Extension classes : Java Extension mechanism的类(The extension mechanism provides a standard, scalable way to make custom APIs available to all applications running on the Java platform),相当于对platform’s core API的扩展,https://docs.oracle.com/javase/tutorial/ext/
  • User classes : 使用 -classpath 参数指定或者在CLASSPATH环境变量中设置

Java Launcher解析JAR中的类

  • JAR中的manifest文件描述该jar包的内容
0 0
原创粉丝点击