public void exec(String[] args) throws Throwable {
  URLClassLoader urlClassLoader=new URLClassLoader(classPath.toArray(new URL[classPath.size()]));
  Class<?> cls=urlClassLoader.loadClass(mainClass);
  Method method=cls.getDeclaredMethod("main",String[].class);
  method.setAccessible(true);
  try {
    method.invoke(null,new Object[]{args});
  }
 catch (  InvocationTargetException e) {
    throw e.getTargetException();
  }
}

public void exec ( String [ ] args ) throws Throwable { URLClassLoader urlClassLoader = new URLClassLoader ( classPath . toArray ( new URL [ classPath . size ( ) ] ) ) ; Class < ? > cls = urlClassLoader . loadClass ( mainClass ) ; Method method = cls . getDeclaredMethod ( "main" , String [ ] . class ) ; method . setAccessible ( true ) ; try { method . invoke ( null , new Object [ ] { args } ) ; } catch ( InvocationTargetException e ) { throw e . getTargetException ( ) ; } }
execute with given arguments
