Class<?> mainClass = null;
try {
mainClass = getClass().getClassLoader().loadClass(mainClassName);
} catch (ClassNotFoundException e1) {
e1.printStackTrace();
throw new MarathonException(e1.getMessage() + " in " + getMainClass() + ".main()", e1);
}
Method main = null;
try {
main = mainClass.getMethod("main", new Class[] { String[].class });
} catch (SecurityException e1) {
e1.printStackTrace();
throw new MarathonException(e1.getMessage() + " in " + getMainClass() + ".main()", e1);
} catch (NoSuchMethodException e1) {
e1.printStackTrace();
throw new MarathonException(e1.getMessage() + " in " + getMainClass() + ".main()", e1);
}
try {
main.invoke(null, new Object[] { args });
} catch (InvocationTargetException e) {
Throwable cause = e.getTargetException();
throw new MarathonException(cause.getMessage() + " in " + getMainClass() + ".main()", cause);
} catch (Exception e) {
throw new MarathonException(e.getMessage() + " in " + getMainClass() + ".main()", e);
}
}