How to check if a file exists in Java Posted on March 4, 2024 Using java.io.File: File f = new File(filePathString); if(f.exists() && !f.isDirectory()) { // do something }