private static URL getFileURL(File file) throws GuacamoleException {

        // Validate extension-related file is indeed a file
        if (!file.isFile())
            throw new GuacamoleServerException("\"" + file + "\" is not a file.");

        try {
            return file.toURI().toURL();
        }
        catch (MalformedURLException e) {
            throw new GuacamoleServerException(e);
        }

    }
Returns the URL that refers to the given file. If the given file refers
to a directory, an exception is thrown.

@param file
    The file to determine the URL of.

@return
    A URL that refers to the given file.

@throws GuacamoleException
    If the given file refers to a directory.
guacamole/src/main/java/org/apache/guacamole/extension/ExtensionClassLoader.java