|
2004.04.29 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--com.jdc.sys.ClassPath
ClassPath provides a reference to the Java system classpath. This
reference is essentially the same as SystemProperty class SystemProperty.CLASS_PATH
constant.
toArray() which returns the individual system classpath entries as a
String[] array.
ClassPath may also be used to modify the system classpath at runtime.
Since the system ClassLoader obtained using ClassLoader.getSystemClassLoader()
is a subclass of URLClassLoader, it may be cast as a URLClassLoader
and used as one.
URLClassLoader has a protected method URLClassLoader.addURL(URL), which may
be used to add files, jars, web addresses or any valid URL.
Since the addURL method is protected, reflection is used to invoke it.
Reference: Modify Classpath At Runtime
SystemProperty.CLASS_PATH| Constructor Summary | |
ClassPath()
Constructs a new ClassPath object. |
|
| Method Summary | |
void |
addFile(File file)
Adds the specified File to the system class path. |
void |
addFile(String fileName)
Adds the specified file name to the system class path. |
void |
addURL(String urlName)
Adds the specified URL name to the system class path. |
void |
addURL(URL url)
Adds the specified URL to the system class path. |
String[] |
getAllPaths()
Returns all possible Java class path directories as a String[]
array in class path order. |
String[] |
getPaths()
Returns the Java class path directories as a String[] array in
class path order. |
String[] |
toArray()
Returns the Java class path entries as a String[] array in
class path order. |
String |
toString()
Returns the complete Java class path as a String. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public ClassPath()
ClassPath object.
| Method Detail |
public void addFile(File file)
throws IOException
File to the system class path.
IOException
public void addFile(String fileName)
throws IOException
IOException
public void addURL(String urlName)
throws IOException
IOException
public void addURL(URL url)
throws IOException
URL to the system class path.
IOExceptionpublic String[] getAllPaths()
String[]
array in class path order.
String[] array.public String[] getPaths()
String[] array in
class path order.
String[] array.public String[] toArray()
String[] array in
class path order.
String[] array.public String toString()
String.
toString in class ObjectString.
|
2004.04.29 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||