Here you can find the source of fileExists(String fName)
public static boolean fileExists(String fName)
//package com.java2s; /******************************************************************************* * Copyright ? 2012-2015 eBay Software Foundation * This program is dual licensed under the MIT and Apache 2.0 licenses. * Please see LICENSE for more information. *******************************************************************************/ import java.io.File; public class Main { /**//from w w w. j av a 2 s .c o m * Test if a file exists or not */ public static boolean fileExists(String fName) { boolean result = false; File file = new File(fName); if (file != null) { result = file.exists() && file.isFile(); } return result; } }