When calling the main method of a Java class from another main method using reflection,
Class thisClass = loader.loadClass(packClassName);
Method thisMethod
Perceptions answer looks correct; if you need load from a Jar not in the class path you can use a URL class loader
try {
URL[] urls;
URLClassLoader urlLoader;
urls = ...;
urlLoader = new URLClassLoader(urls);
@SuppressWarnings("rawtypes")
Class runClass = urlLoader.loadClass(classToRun);
Object[] arguments = new Object[]{args};
Method mainMethod = runClass.getMethod("main", String[].class);
mainMethod.invoke(null, arguments);
} catch (Exception e) {
e.printStackTrace();
}