41 |
import gnu.java.rmi.server.RMIClassLoaderImpl; |
import gnu.java.rmi.server.RMIClassLoaderImpl; |
42 |
|
|
43 |
import java.net.MalformedURLException; |
import java.net.MalformedURLException; |
44 |
|
import java.net.URL; |
45 |
|
|
46 |
/** |
/** |
47 |
* This class provides a set of public static utility methods for supporting |
* This class provides a set of public static utility methods for supporting |
85 |
} |
} |
86 |
|
|
87 |
/** |
/** |
88 |
|
* Loads a class from <code>codeBase</code>. |
89 |
|
* |
90 |
|
* This method delegates to |
91 |
|
* {@link RMIClassLoaderSpi#loadClass(String, String, ClassLoader)} and |
92 |
|
* passes <code>codeBase.toString()</code> as first argument, |
93 |
|
* <code>name</code> as second argument and <code>null</code> as third |
94 |
|
* argument. |
95 |
|
* |
96 |
|
* @param codeBase the code base from which to load the class |
97 |
|
* @param name the name of the class |
98 |
|
* |
99 |
|
* @return the loaded class |
100 |
|
* |
101 |
|
* @throws MalformedURLException if the URL is not well formed |
102 |
|
* @throws ClassNotFoundException if the requested class cannot be found |
103 |
|
*/ |
104 |
|
public static Class loadClass(URL codeBase, String name) |
105 |
|
throws MalformedURLException, ClassNotFoundException |
106 |
|
{ |
107 |
|
RMIClassLoaderSpi spi = getProviderInstance(); |
108 |
|
if (spi == null) |
109 |
|
spi = getDefaultProviderInstance(); |
110 |
|
return spi.loadClass(codeBase.toString(), name, null); |
111 |
|
} |
112 |
|
|
113 |
|
/** |
114 |
* Gets a classloader for the given codebase and with the current |
* Gets a classloader for the given codebase and with the current |
115 |
* context classloader as parent. |
* context classloader as parent. |
116 |
* |
* |