code: 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);
      }
docs: Returns a File object for the given resource. The resource is attempted
  to be loaded from the class loader.
  
  @param resource path
  @return the file reference for the resource