1URLClassLoader child = new URLClassLoader(
2 new URL[] {myJar.toURI().toURL()},
3 this.getClass().getClassLoader()
4);
5Class classToLoad = Class.forName("com.MyClass", true, child);
6Method method = classToLoad.getDeclaredMethod("myMethod");
7Object instance = classToLoad.newInstance();
8Object result = method.invoke(instance);
9