Java File Exist fileExists(String path)

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

Description

Checks to see if the file or directory specified in the path actually exists

License

Open Source License

Parameter

Parameter Description
path a parameter

Return

true if it does

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 {
    /**/*from www  . j av a 2s .  c o m*/
     * Checks to see if the file or directory specified in the path actually
     * exists
     * 
     * @param path
     * @return true if it does
     */
    public static boolean fileExists(String path) {
        if (path.length() > 0) {
            if ((new File(path)).exists()) {
                return true;
            } else {
                return false;
            }
        } else {
            return false;
        }
    }
}

Related

  1. fileExists(String fName)
  2. fileExists(String folderPath, String fileName)
  3. fileExists(String name)
  4. fileExists(String parentDirectory, String filename)
  5. fileExists(String path)
  6. fileExists(String path)
  7. fileExists(String path)
  8. fileExists(String path)
  9. fileExists(String path, boolean throwException)