goja-core/src/main/java/goja/core/kits/io/ResourceKit.java
public static File getFile(String resourceLocation) throws FileNotFoundException {
        Preconditions.checkNotNull(resourceLocation, "Resource location must not be null");
        if (resourceLocation.startsWith(CLASSPATH_URL_PREFIX)) {
            String path = resourceLocation.substring(CLASSPATH_URL_PREFIX.length());
            String description = "class path resource [" + path + "]";
            URL url = ClassKit.getDefaultClassLoader().getResource(path);
            if (url == null) {
                throw new FileNotFoundException(
                        description + " cannot be resolved to absolute file path " +
                                "because it does not reside in the file system"
                );
            }
            return getFile(url, description);
        }
        try {
            // try URL
            return getFile(new URL(resourceLocation));
        } catch (MalformedURLException ex) {
            // no URL -> treat as file path
            return new File(resourceLocation);
        }
    }
public static File getFile(String resourceLocation) throws FileNotFoundException {
        Preconditions.checkNotNull(resourceLocation, "Resource location must not be null");
        if (resourceLocation.startsWith(CLASSPATH_URL_PREFIX)) {
            String path = resourceLocation.substring(CLASSPATH_URL_PREFIX.length());
            String description = "class path resource [" + path + "]";
            URL url = ClassKit.getDefaultClassLoader().getResource(path);
            if (url == null) {
                throw new FileNotFoundException(
                        description + " cannot be resolved to absolute file path " +
                                "because it does not reside in the file system"
                );
            }
            return getFile(url, description);
        }
        try {
            // try URL
            return getFile(new URL(resourceLocation));
        } catch (MalformedURLException ex) {
            // no URL -> treat as file path
            return new File(resourceLocation);
        }
    }
public static File getFile ( String resourceLocation ) throws FileNotFoundException { Preconditions . checkNotNull ( resourceLocation , "Resource location must not be null" ) ; if ( resourceLocation . startsWith ( CLASSPATH_URL_PREFIX ) ) { String path = resourceLocation . substring ( CLASSPATH_URL_PREFIX . length ( ) ) ; String description = "class path resource [" + path + "]" ; URL url = ClassKit . getDefaultClassLoader ( ) . getResource ( path ) ; if ( url == null ) { throw new FileNotFoundException ( description + " cannot be resolved to absolute file path " + "because it does not reside in the file system" ) ; } return getFile ( url , description ) ; } try { // try URL return getFile ( new URL ( resourceLocation ) ) ; } catch ( MalformedURLException ex ) { // no URL -> treat as file path return new File ( resourceLocation ) ; } }
Resolve the given resource location to a {@code java.io.File}, i.e. to a file in the file
system. <p>Does not check whether the file actually exists; simply returns the File that the
given location would correspond to.

@param resourceLocation the resource location to resolve: either a "classpath:" pseudo URL, a
"file:" URL, or a plain file path
@return a corresponding File object
@throws FileNotFoundException if the resource cannot be resolved to a file in the file
system
Resolve the given resource location to a { @code java . io . File } i . e . to a file in the file system . <p > Does not check whether the file actually exists ; simply returns the File that the given location would correspond to .