public static File resolve(Class<?> clazz, String path)
    {
        URL url = clazz.getResource(path);
        if (url == null)
        {
            return null;
        }

        File result;
        try
        {
            result = Paths.get(url.toURI()).toFile();
        }
        catch (URISyntaxException ex)
        {
            return null;
        }

        return result;
    }
public static File resolve ( Class < ? > clazz , String path ) { URL url = clazz . getResource ( path ) ; if ( url == null ) { return null ; } File result ; try { result = Paths . get ( url . toURI ( ) ) . toFile ( ) ; } catch ( URISyntaxException ex ) { return null ; } return result ; }
Return target file path from class and resource's path.

@param clazz Target class
@param path resource's path
@return File object