Here you can find the source of FileExists(String filePath)
Parameter | Description |
---|---|
filePath | Absolute file path |
Parameter | Description |
---|---|
Exception | an exception |
public static boolean FileExists(String filePath) throws Exception
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { /** Indicates whether a file exists (and is not a directory). */*from w w w.j a v a2s . com*/ * @param filePath Absolute file path * @return Whether the file exists (and is not a directory) * @throws Exception */ public static boolean FileExists(String filePath) throws Exception { File file = new File(filePath); return file.exists() && !file.isDirectory(); } }