To check if a file exists in Java you can use the following snippet.
Sample Java
String filePath = "C:\\Users\\Codesnippets\\Desktop\\Test.xml"; File file = new File(filePath); if (file.exists()) { System.out.println("file " + filePath + " does exists!"); } else { System.out.println("file " + filePath + " does not exists!"); }
RT @CodeSnippetsNET: How to check if a file exists in #Java http://t.co/hcNYAHbCAa #code #programming #coding