Here you can find the source of add(File file)
public static void add(File file)
//package com.java2s; //License from project: Open Source License import java.io.File; import java.lang.reflect.Method; import java.net.URL; import java.net.URLClassLoader; public class Main { private static final URLClassLoader systemClassLoader = (URLClassLoader) ClassLoader.getSystemClassLoader(); public static void add(URL url) { try {// w ww.j ava 2 s . c o m Method method = URLClassLoader.class.getDeclaredMethod("addURL", URL.class); method.setAccessible(true); method.invoke(systemClassLoader, url); } catch (Exception ex) { // ignore exception } } public static void add(File file) { try { add(file.toURI().toURL()); } catch (Exception ex) { // ignore exception } } }