Skip to content

Latest commit

 

History

History
9 lines (9 loc) · 507 Bytes

File metadata and controls

9 lines (9 loc) · 507 Bytes

How To add an External jar File to the ClassPath Dynamically at runtime?

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