Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Classpath ¶
type Classpath struct {
// contains filtered or unexported fields
}
Classpath * 三个 Entry 变量分别代表: 1. bootClasspath : 启动类路径 2. extClasspath : 扩展类路径 3. userClasspath : 用户类路径
type CompositeEntry ¶
type CompositeEntry []Entry
CompositeEntry * CompositeEntry由更小的Entry组成,正好可以表示 成[]Entry。在Go语言中,数组属于比较低层的数据结构,很少直接 使用。大部分情况下,使用更便利的slice类型。
func (CompositeEntry) String ¶
func (self CompositeEntry) String() string
type DirEntry ¶
type DirEntry struct {
// contains filtered or unexported fields
}
DirEntry * 目录形式的类路径结构 成员变量说明: absDir:存放类的绝对路径
type Entry ¶
type Entry interface { // String /** toString方法 */ String() string // contains filtered or unexported methods }
Entry * 在加载主类之前,jvm首先会加载它的超类,如果没有明确的继承关系,那么其父类便是:java.lang.Object。 执行main方法之前还需要加载java.lang.String类以及java.lang.String[]. 于是虚拟机面临这样一个问题:虚拟机如何寻找需要加载的类的。
Java虚拟机规范给了足够的自由:从何处加载class文件并没有作硬性的规定。可以来自: 1. 文件系统中的zip或者jar文件 2. 网络、数据库 3. 运行期间生成的class文件
Java虚拟机规范并没有规定虚拟机去哪里加载类,于是实现方式由虚拟机实现者自定。通常的实现是:根据类路径来搜索类。通常分为三种类: 1. 启动类路径 默认对应jre/lib 2. 扩展类路径 默认对应jre/lib/ext 3. 用户类路径 默认当前目录
类路径接口表示: 将类路径对应的类读取到内存中。