You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MultipleDumpTest.java 674B

123456789101112131415161718192021222324
  1. import java.lang.reflect.InvocationTargetException;
  2. import java.lang.reflect.Method;
  3. public class MultipleDumpTest {
  4. public static void main(String[] args) throws Exception {
  5. System.out.println("? MultipleDumpTest.main()");
  6. invokeMain("Class1",args);
  7. invokeMain("Class2",args);
  8. invokeMain("Class3",args);
  9. }
  10. private static void invokeMain (String className, String[] args) throws Exception
  11. {
  12. Class clazz = Class.forName(className);
  13. Class[] paramTypes = new Class[1];
  14. paramTypes[0] = args.getClass();
  15. Method method = clazz.getDeclaredMethod("main",paramTypes);
  16. Object[] params = new Object[1];
  17. params[0] = args;
  18. method.invoke(null,params);
  19. }
  20. }