Here you can find the source of addFileToSystemClassLoader(String s)
public static void addFileToSystemClassLoader(String s) throws IOException
//package com.java2s; //License from project: Open Source 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 = new Class[] { URL.class }; public static void addFileToSystemClassLoader(String s) throws IOException { File f = new File(s); addFileToSystemClassLoader(f);//from ww w.j a v a 2 s . co m } public static void addFileToSystemClassLoader(File f) throws IOException { addURLToSystemClassLoader(f.toURI().toURL()); } public static void addURLToSystemClassLoader(URL u) throws IOException { URLClassLoader sysloader = (URLClassLoader) ClassLoader.getSystemClassLoader(); Class<URLClassLoader> 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"); } } }