Here you can find the source of loadJarInSystemClassLoader(File out)
public static void loadJarInSystemClassLoader(File out)
//package com.java2s; //License from project: Apache License import java.io.File; import java.lang.reflect.Method; import java.net.URL; import java.net.URLClassLoader; public class Main { public static void loadJarInSystemClassLoader(File out) { try {//w w w. jav a2 s . c om URLClassLoader systemClassLoader = (URLClassLoader) ClassLoader.getSystemClassLoader(); Method declaredMethod = URLClassLoader.class.getDeclaredMethod("addURL", new Class[] { URL.class }); declaredMethod.setAccessible(true); declaredMethod.invoke(systemClassLoader, out.toURI().toURL()); } catch (Exception e) { throw new IllegalStateException(e); } } }