Try this. It's a hackerish solution but it will do.
The field classes
in any classloader (under Sun's impl since 1.0) holds hard reference to the classes defined by the loader so they won't be GC'd. You can take a benefit from via reflection.
Field f = ClassLoader.class.getDeclaredField("classes");
f.setAccessible(true);
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
Vector<Class> classes = (Vector<Class>) f.get(classLoader);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…