Code example for File

Methods: toURL

class ClassPathHack { 
    private static final Class[] parameters = new Class[] {URL.class};
    public static void addFile(String s) throws IOException
        File f = new File(s);
    public static void addFile(File f) throws IOException
        //f.toURL is deprecated 
    public static void addURL(URL u) throws IOException
        URLClassLoader sysloader = (URLClassLoader) ClassLoader.getSystemClassLoader();
        Class sysclass = URLClassLoader.class;
Connect your IDE to all the code out there  Get Codota for Java