Epa*_*aga 62 java class classloader
如果我使用
try {
Class.forName("my.package.Foo");
// it exists on the classpath
} catch(ClassNotFoundException e) {
// it does not exist on the classpath
}
Run Code Online (Sandbox Code Playgroud)
"Foo"的静态初始化程序块启动.有没有办法确定类"my.package.Foo"是否在类路径上而没有启动其静态初始化程序?
And*_*dré 81
尝试使用forName(String name, boolean initialize, ClassLoader loader)方法Class并将参数设置initialize为false.