Java File Exist fileExists(String path)

Here you can find the source of fileExists(String path)

Description

file Exists

License

Open Source License

Declaration

public static boolean fileExists(String path) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.File;

public class Main {
    public static boolean fileExists(String path) {
        try {// w w  w. j  a  va 2 s  .  com
            File f = new File(path);
            return f.exists() && f.isFile();
        } catch (Exception e) {
            throw new RuntimeException("Checking if file exists failed", e);
        }
    }
}

Related

  1. fileExists(String parentDirectory, String filename)
  2. fileExists(String path)
  3. fileExists(String path)
  4. fileExists(String path)
  5. fileExists(String path)
  6. fileExists(String path, boolean throwException)
  7. fileExists(String path, String fileName)
  8. fileExists(String s)
  9. fileExistsAndCanRead(final String filePath)