同样,不能加载这些JAR文件的多个版本,因为类都位于系统类加载器名称空间中。
Also, you will not be able load multiple versions of these JAR files as the classes will all be in the system class loaders namespace.
这里,我们使用反射的原因是因为我们已经使用非系统类加载器加载了应用程序。
Here, we use reflection because we have loaded the application using a class loader that is not the system class loader.
如果这些类在类路径中可用,URLClassLoader实例的父加载器(即系统类加载器)将加载它们。
If these classes are available in the classpath, the parent of the URLClassLoader instance, which is the system class loader, will load them.
与基于解释器的系统不同,所加载的类可以从JRE的运行时优化中受益。
Unlike interpreter-based systems, your loaded classes benefit from all the JRE's runtime optimizations.
因此,尽管在传统应用中,来自logging类库、client和serverJAR中的类都是由同一个类加载器加载的,但在OSGi模块系统中,他们都是由自己的类加载器加载的。
So whilst in a traditional application, classes from a logging library, a client and server JAR may be loaded by the same class loader, in an OSGi module system, each would be loaded by their own.
在大部分unix类系统中,加载器通常在环境变量ld_library _ PATH中列出的目录中开始搜索库。
On most Unix-like systems, the loader's search for libraries normally begins with any directories listed in the environment variable LD_LIBRARY_PATH.
同样的,Jini和RMI系统也会使用不同的类加载器去加载不同来源的代码。
Similarly, Jini and RMI systems may use a separate class loader for the different code bases from which they download class files.
同样的,Jini和RMI系统也会使用不同的类加载器去加载不同来源的代码。
Similarly, Jini and RMI systems may use a separate class loader for the different code bases from which they download class files.
应用推荐