public static File getResourceAsFile ( final String resource ) { final ClassLoader classLoader = FileUtils . class . getClassLoader ( ) ; final String path = classLoader != null ? classLoader . getResource ( resource ) . getFile ( ) : ClassLoader . getSystemResource ( resource ) . getFile ( ) ; if ( path == null ) { return new File ( resource ) ; } return new File ( path ) ; }
Returns a File object for the given resource . The resource is attempted to be loaded from the class loader .