Here you can find the source of invokeMain(Method main, String[] args)
public static void invokeMain(Method main, String[] args)
//package com.java2s; /*//from w ww . j av a 2 s . co m * Copyright (C) 2006-2009 * Woei-Kae Chen <wkc@csie.ntut.edu.tw> * Hung-Shing Chao <s9598007@ntut.edu.tw> * Tung-Hung Tsai <s159020@ntut.edu.tw> * Zhe-Ming Zhang <s2598001@ntut.edu.tw> * Zheng-Wen Shen <zwshen0603@gmail.com> * Jung-Chi Wang <snowwolf725@gmail.com> * * This file is part of GTT (GUI Testing Tool) Software. * * GTT is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * GTT is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * GNU GENERAL PUBLIC LICENSE http://www.gnu.org/licenses/gpl */ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; public class Main { public static void invokeMain(Method main, String[] args) { try { if (main.getParameterTypes().length != 0) { main.invoke(null, new Object[] { args }); } else { main.invoke(null, new Object[] {}); } } catch (IllegalArgumentException e) { System.err.println("instanceAUTbyMain err:" + e.getMessage()); } catch (IllegalAccessException e) { System.err.println("instanceAUTbyMain err:" + e.getMessage()); } catch (InvocationTargetException e) { System.err.println("instanceAUTbyMain err:" + e.getMessage()); } } }