Loading Java jars programmatically

How to import a Java Jar at runtime:

URLClassLoader child = new URLClassLoader (myJar.toURL(), this.getClass().getClassLoader());
Class classToLoad = Class.forName ("com.MyClassName", true, child);
Method method = classToLoad.getDeclaredMethod ("myMethodName");
Object instance = classToLoad.newInstance ();
Object result = method.invoke (instance);