code: public void invokeMain(String className, String[] args) throws Throwable {
  
          Class<?> clazz = loadClass(className);
  
          debug(String.format("Launch: %s.main(); Loader: %s", className, clazz.getClassLoader()));
  
          Method method = clazz.getMethod("main", String[].class);
  
          if (method == null) {
              throw new NoSuchMethodException("The main() method in class \"" + className + "\" not found.");
          }
  
          try {
              method.invoke(null, (Object)args);
          } catch (InvocationTargetException e) {
              throw e.getTargetException();
          }
      }
docs: Invokes main() method on class with provided parameters.