Here you can find the source of fileExists(String aFilename)
Parameter | Description |
---|---|
aFilename | the filename to be checked |
public static boolean fileExists(String aFilename)
//package com.java2s; import java.io.File; public class Main { /**/*w w w .j av a2 s.co m*/ * Helper method to check for file existence * @param aFilename the filename to be checked */ public static boolean fileExists(String aFilename) { boolean exists = false; try { exists = new File(aFilename).exists(); } catch (Throwable th) { // Ignore exception, failure is good enough } return exists; } }