1 |
import java.lang.reflect.*;
void addClassPath(URL url) throws NoSuchMethodException,IllegalAccessException,InvocationTargetException {
// URLClassLoaderのprotectedメソッドaddURLを取得する
Method method = URLClassLoader.class.getDeclaredMethod(
"addURL",
new Class[] { URL.class });
// アクセス可能に変更する
method.setAccessible(true);
// システムクラスローダーをURLClassLoaderと仮定し、addURLをコールする
method.invoke(ClassLoader.getSystemClassLoader(), new Object[] { url });
} |
[通知用URL]
Tweet
最終更新時間:2011年10月19日 22時42分37秒