code: private static URL makeURLFromFilespec(final String filespec, final String relativePrefix)
              throws IOException
     {
        // make sure the file is absolute & canonical file url
        File file = new File(decode(filespec));
  
        // if we have a prefix and the file is not abs then prepend
        if (relativePrefix != null && !file.isAbsolute())
        {
           file = new File(relativePrefix, filespec);
        }
  
        // make sure it is canonical (no ../ and such)
        file = file.getCanonicalFile();
  
        return file.toURI().toURL();
     }
docs: A helper to make a URL from a filespec.