Code example for File

Methods: toURL

0
class ClassPathHack { 
    private static final Class[] parameters = new Class[] {URL.class};
 
    public static void addFile(String s) throws IOException
    { 
        File f = new File(s);
        addFile(f);
    } 
 
    public static void addFile(File f) throws IOException
    { 
        //f.toURL is deprecated 
        addURL(f.toURL());
    } 
 
    public static void addURL(URL u) throws IOException
    { 
        URLClassLoader sysloader = (URLClassLoader) ClassLoader.getSystemClassLoader();
        Class sysclass = URLClassLoader.class;
 
        try {