[other]Custom URL classloader
来源:互联网 发布:what s up 软件 编辑:程序博客网 时间:2024/06/09 19:56
利用定制的urlClassloader在程序中动态的加载类文件。
- package com.flylb.util;
- import java.io.File;
- import java.net.MalformedURLException;
- import java.net.URL;
- import java.net.URLClassLoader;
- public class MyUrlClassLoader {
- private URLClassLoader urlCl;
- public MyUrlClassLoader(URL[] url, ClassLoader parentClassLoader) {
- urlCl = new URLClassLoader(url, parentClassLoader);
- }
- public URLClassLoader getUrlCl() {
- return urlCl;
- }
- public static void main(String[] args) {
- URL[] cp = new URL[10];
- try {
- cp[0] = new File("E://eclipse_rcp_app//Hello//bin").toURI().toURL();
- } catch (MalformedURLException e) {
- e.printStackTrace();
- }
- MyUrlClassLoader mcl = new MyUrlClassLoader(cp, MyUrlClassLoader.class.getClassLoader());
- URLClassLoader ucl = mcl.getUrlCl();
- Class<?> c = null;
- try {
- c = Class.forName("test.Hello", false, ucl);
- c.getMethod("main", String[].class).invoke(null, new Object[] { args });
- } catch (ClassNotFoundException e1) {
- e1.printStackTrace();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- [other]Custom URL classloader
- java custom classloader
- Custom Url Schemes
- Implementing Custom URL Schemes
- Objective-C: Custom URL Schemes
- You cannot combine custom titles with other title features
- You cannot combine custom titles with other title feature
- You cannot combine custom titles with other title feature..
- Cannot Combine Custom Title With Other Title Features
- You cannot combine custom titles with other title features
- 【Theme】cannot combine custom titles with other title feature
- You cannot combine custom titles with other title features
- You cannot combine custom titles with other title feature
- You cannot combine custom titles with other title features
- You cannot combine custom titles with other title features
- You cannot combine custom titles with other title features
- AndroidRuntimeException: You cannot combine custom titles with other title feature
- You cannot combine custom titles with other title features
- 尚学堂视频
- 时间
- 我的数码单反相机,艰难的选择!
- linux线程
- 如何获得管理员密码
- [other]Custom URL classloader
- 文件碎片/磁盘碎片的一些知识
- 一个无聊男人的疯狂《数据结构与算法分析-C++描述》学习笔记 习题2.8 随机数组的三种生成算法(补) 将bash的实现翻译成比较纯正的bash风格
- Java生成静态页面的简单方法和代码
- C# Tostring() 格式大全 [转]
- 生产者-消费者实例
- "无法找到“XXX.exe”的调试信息,或者调试信息不匹配。未使用调试信息生成二进制文件"的解决方法
- Cocoa中对日期和时间的处理 NSCalendar (二)
- c++学习心得