jvm是否加载了类路径提到的所有类? [英] Does jvm load all the classes mentioned by the classpath?
问题描述
当我们用-cp命令调用java命令时,我们提供了一些目录和jar文件。
jvm是否加载了类路径提到的所有类或者它只是jvm在需要时会查找的所有类的超集?
When we invoke java command with -cp command then we provide some directories and jar files. Does jvm load all the classes mentioned by the classpath Or it is just a super set of all classes which jvm will look up to load when required?
推荐答案
jvm是否加载了类路径提到的所有类或者只是
a所有类的超级集合jvm将在$ b $时加载b必需?
Does jvm load all the classes mentioned by the classpath Or it is just a super set of all classes which jvm will look up to load when required?
JVM根据需要从类路径加载类,即当找到类的引用时,它会被加载。 JVM中还有一个类加载器的层次结构,由较低类加载器使用由父类加载器加载的类。
JVM loads classes form the classpath on the need basis i.e. when a reference is found for the class, it is loaded. Also there is a hierarchy of class loaders in JVM, a class loaded by the parent class loader is used by the lower class loaders.
这篇关于jvm是否加载了类路径提到的所有类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!