Package com.sun.jini.start
Class ClassLoaderUtil
java.lang.Object
com.sun.jini.start.ClassLoaderUtil
This class provides useful utilities for creating and manipulating class loaders.
- Author:
- Sun Microsystems, Inc.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voiddisplayClassLoaderTree(ClassLoader classloader) Utility method that displays the class loader delegation tree for the given class loader.static voidUtility method that displays the class loader delegation tree for the current context class loader.static URL[]getClasspathURLs(String classpath) Utility method that converts the components of aStringrepresenting a classpath into fileURL(s).static URL[]getCodebaseURLs(String codebase) Utility method that converts the components of aStringrepresenting a codebase into standardURL(s).static URL[]getImportCodebaseURLs(String importCodebase) Utility method that converts the components of aStringrepresenting a codebase or classpath intoURL(s).
-
Method Details
-
getClasspathURLs
Utility method that converts the components of aStringrepresenting a classpath into fileURL(s).- Parameters:
classpath-Stringcontaining components separated by path separators that represent the components making up a classpath- Returns:
- a
URL[]where each element of the array corresponds to one of the components in theclasspathparameter. The path components are (potentially) expanded viaFile.getCanonicalFile()before converting to aURLformat. - Throws:
MalformedURLException- If the path cannot be parsed as a URLjava.net.IOException- If an I/O error occurs, which is possible because the construction of the canonical pathname may require filesystem queriesIOException
-
getCodebaseURLs
Utility method that converts the components of aStringrepresenting a codebase into standardURL(s).- Parameters:
codebase-Stringcontaining components separated by spaces in which each component is inURLformat.- Returns:
- a
URL[]where each element of the array corresponds to one of the components in thecodebaseparameter - Throws:
MalformedURLException
-
getImportCodebaseURLs
public static URL[] getImportCodebaseURLs(String importCodebase) throws IOException, MalformedURLException Utility method that converts the components of aStringrepresenting a codebase or classpath intoURL(s).- Parameters:
importCodebase-Stringassumed (in order) to be either 1) a space delimited set ofURL(s) representing a codebase or 2) aFile.pathSeparatordelimited set of class paths.- Returns:
- a
URL[]where each element of the array corresponds to one of the components in theimportCodebaseparameter - Throws:
MalformedURLException- If the path cannot be parsed as a URLjava.net.IOException- If an I/O error occurs, which is possible because the construction of the canonical pathname may require filesystem queriesIOException
-
displayContextClassLoaderTree
public static void displayContextClassLoaderTree()Utility method that displays the class loader delegation tree for the current context class loader. For each class loader in the tree, this method displays the locations from which that class loader will retrieve and load requested classes.This method can be useful when debugging problems related to the receipt of exceptions such as
ClassNotFoundException. -
displayClassLoaderTree
Utility method that displays the class loader delegation tree for the given class loader. For each class loader in the tree, this method displays the locations from which that class loader will retrieve and load requested classes.This method can be useful when debugging problems related to the receipt of exceptions such as
ClassNotFoundException.- Parameters:
classloader-ClassLoaderinstance whose delegation tree is to be displayed
-