|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.ClassLoader | +--MAEPlugin.JarClassLoader
JarClassLoader provides a minimalistic ClassLoader which shows how to instantiate a class which resides in a .jar file.
This work was produced by Peter Lemkin of the National Cancer Institute, an agency of the United States Government. As a work of the United States Government there is no associated copyright. It is offered as open source software under the Mozilla Public License (version 1.1) subject to the limitations noted in the accompanying LEGAL file. This notice must be included with the code. The MAExplorer Mozilla and Legal files are available on http://maexplorer.sourceforge.net/.
Inner classes inherited from class java.lang.ClassLoader |
java.lang.ClassLoader.NativeLibrary |
Field Summary | |
private java.util.Hashtable |
classes
Contains the loaded classes |
private char |
classNameReplacementChar
Utility Char |
private JarResources |
jarResources
utility object that loads resources from a Jar |
Fields inherited from class java.lang.ClassLoader |
bootstrapClassPath, defaultDomain, defaultPermissions, domains, getClassLoaderPerm, initialized, loadedLibraryNames, nativeLibraries, nativeLibraryContext, nocerts, package2certs, packages, parent, scl, sclSet, sys_paths, systemNativeLibraries, usr_paths |
Constructor Summary | |
JarClassLoader(java.io.File jarFile)
JarClassLoader() - constructor2 that loads jar from the path that is derived from the jarFile. |
|
JarClassLoader(java.lang.String jarPath)
JarClassLoader() - default constructor that loads jar from the jarPath. |
Method Summary | |
protected java.lang.String |
formatClassName(java.lang.String className)
formatClassName() - generate a name with ".class" extension |
JarResources |
getJarResources()
|
java.lang.Class |
loadClass(java.lang.String className)
loadClass() - load specified class and let it resolve the class if necessary. |
java.lang.Class |
loadClass(java.lang.String className,
boolean resolveIt)
loadClass() - load specified class |
protected byte[] |
loadClassBytes(java.lang.String className)
loadClassBytes() loads bytes for class files. |
void |
setClassNameReplacementChar(char replacement)
setClassNameReplacementChar() - remap class name. |
Methods inherited from class java.lang.ClassLoader |
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
Field Detail |
private JarResources jarResources
private java.util.Hashtable classes
private char classNameReplacementChar
Constructor Detail |
public JarClassLoader(java.lang.String jarPath)
jarPath
- is the path of the Jar filepublic JarClassLoader(java.io.File jarFile)
jarFile
- is the Jar file.Method Detail |
protected byte[] loadClassBytes(java.lang.String className)
className
- of class to load bytes frompublic java.lang.Class loadClass(java.lang.String className) throws java.lang.ClassNotFoundException
loadClass
in class java.lang.ClassLoader
className
- name of the class to loadjava.lang.ClassNotFoundException
- public java.lang.Class loadClass(java.lang.String className, boolean resolveIt) throws java.lang.ClassNotFoundException
loadClass
in class java.lang.ClassLoader
className
- name of the class to loadresolveIt
- lets it resolve the class if necessaryjava.lang.ClassNotFoundException
- public void setClassNameReplacementChar(char replacement)
replacement
- character to assign.protected java.lang.String formatClassName(java.lang.String className)
className
- class namepublic JarResources getJarResources()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |