public class Loader extends Object
public class MyClass { void myMethod() { ... Class c=Loader.loadClass(this.getClass(),classname); ... }
Constructor and Description |
---|
Loader() |
Modifier and Type | Method and Description |
---|---|
static String |
getClassPath(ClassLoader loader)
Generate the classpath (as a string) of all classloaders
above the given classloader.
|
static URL |
getResource(Class<?> loadClass,
String name) |
static ResourceBundle |
getResourceBundle(Class<?> loadClass,
String name,
boolean checkParents,
Locale locale) |
static Class |
loadClass(Class loadClass,
String name)
Load a class.
|
public static Class loadClass(Class loadClass, String name) throws ClassNotFoundException
loadClass
- a similar class, belong in the same classloader of the desired class to loadname
- the name of the new class to load, using the same ClassLoader as the loadClass
ClassNotFoundException
- if not able to find the classpublic static ResourceBundle getResourceBundle(Class<?> loadClass, String name, boolean checkParents, Locale locale) throws MissingResourceException
MissingResourceException
public static String getClassPath(ClassLoader loader) throws Exception
loader
- the classloader to useException
- if unable to generate the classpath from the resource referencesCopyright © 1995-2016 Webtide. All Rights Reserved.