首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

扩张类加载器-改变JAVA的父优先类加载顺序

2012-11-07 
扩展类加载器-------改变JAVA的父优先类加载顺序File bundleFile new File(D:\\IDE\\UTMP-Studio-2.0\\

扩展类加载器-------改变JAVA的父优先类加载顺序

File bundleFile = new File("D:\\IDE\\UTMP-Studio-2.0\\workspace\\utmp.code.coverage.test.7_1\\lib\\UTMP","STAR-1.0.jar");if (!bundleFile.exists()) {throw new FileNotFoundException(bundleFile.getAbsolutePath());}// 加载star.jarURL m_osgiFilePathName = bundleFile.toURI().toURL();MCFClassLoader urlClassLoader = new MCFClassLoader(new URL[] { m_osgiFilePathName },AssetWizardSrvImplTest.class.getClassLoader());Method method = URLClassLoader.class.getDeclaredMethod("addURL",URL.class);Boolean methodAccessible = method.isAccessible();method.setAccessible(true);method.invoke(urlClassLoader, m_osgiFilePathName);method.setAccessible(methodAccessible);?

?

?

热点排行