package edu.neu.ccs.demeter.dj; import java.util.*; import java.lang.reflect.*; public class Main extends ClassLoader { Main() { super(null); } Set classes = new HashSet(); protected synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException { Class c = super.loadClass(name, resolve); classes.add(c); System.out.println("Loaded " + c); return c; } /** A wrapper around the user's main, to let us keep track of all classes loaded. */ public static void main(String args[]) throws Exception { System.out.println(getSystemClassLoader()); Main loader = new Main(); Class c = loader.loadClass(args[0]); Method m = c.getMethod("main", new Class[] { String[].class }); String[] newArgs = new String[args.length - 1]; System.arraycopy(args, 1, newArgs, 0, args.length - 1); m.invoke(null, new Object[] { newArgs }); } }