How to check if a file exists in Java
Written on January 8, 2010 at 6:26 am by
mkyong
To determine whether a file is exist in your file system, use the Java IO File.exists().
package com.mkyong.io; import java.io.*; public class FileChecker { public static void main(String args[]) { File f = new File("c:\\mkyong.txt"); if(f.exists()){ System.out.println("File existed"); }else{ System.out.println("File not found!"); } } }
Oracle Magazine (Free)
Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world\'s largest enterprise software company.
Publisher : Oracle Corporation


