package main; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.URL; import org.aspectj.weaver.loadtime.WeavingURLClassLoader; public class Main { static public void main(String[] arg) throws ClassNotFoundException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, IOException { try (WeavingURLClassLoader weaving = new WeavingURLClassLoader( new URL[] { new URL("file:///tmp/java/classe/bin/C.jar"), new URL("file:///tmp/java/aspects/bin/A.jar") }, new URL[] { new URL("file:///tmp/java/aspects/bin/A.jar") }, Thread.currentThread().getContextClassLoader())) { Thread.currentThread().setContextClassLoader(weaving); Class classC = weaving.loadClass("classe.C"); Method mainMethod = classC.getMethod("main", new Class[] { String[].class }); mainMethod.invoke(null, (Object)new String[] { "Start" }); } } }