//load into memory and create an instance
URL[] urls = new URL[] {new URL("file:/" + System.getProperty("user.dir") +"/src")};
URLClassLoader ul = new URLClassLoader(urls);
Class c = ul.loadClass("com.bjsxt.proxy.TankTimeProxy");
System.out.println(c);
Constructor ctr = c.getConstructor(Moveable.class);
Moveable m = (Moveable)ctr.newInstance(new Tank());
m.move();
}
}
package com.bjsxt.compiler.test;
import java.lang.reflect.Method;
public class Test2 {
public static void main(String[] args) {
Method[] methods = com.bjsxt.proxy.Moveable.class.getMethods();
for(Method m : methods) {
System.out.println(m.getName());
}
}
}
package com.bjsxt.proxy;
//load into memory and create an instance
URL[] urls = new URL[] {new URL("file:/" + "d:/src/")};
URLClassLoader ul = new URLClassLoader(urls);
Class c = ul.loadClass("com.bjsxt.proxy.$Proxy1");
System.out.println(c);
Constructor ctr = c.getConstructor(InvocationHandler.class);
Object m = ctr.newInstance(h);
//m.move();