Here you can find the source of AddFile(File f)
public static void AddFile(File f) throws IOException
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.IOException; import java.lang.reflect.Method; import java.net.URL; import java.net.URLClassLoader; public class Main { private static final Class[] parameters = { URL.class }; public static void AddFile(File f) throws IOException { AddURL(f.toURL());//w w w . ja v a 2s. c om } public static void AddURL(URL u) throws IOException { URLClassLoader sysloader = (URLClassLoader) ClassLoader .getSystemClassLoader(); Class sysclass = URLClassLoader.class; try { Method method = sysclass .getDeclaredMethod("addURL", parameters); method.setAccessible(true); method.invoke(sysloader, new Object[] { u }); } catch (Throwable t) { t.printStackTrace(); throw new IOException( "Error, could not add URL to system classloader"); } } }