code: public static File fileFromString(String fileName) {
          try {
              return new File(new URI(fileName).getPath());
          } catch (URISyntaxException ex ) {
              // Not a valid uri
              return new File(fileName);
          }
      }
docs: Get a File from the specified file name.
  
  @param fileName File name using Path or URI
  
  @return File path