How can I check whether a file exists, before opening it for reading in Java (the equivalent of Perl\'s -e $filename>
-e $filename>
You can make it this way
import java.nio.file.Paths; String file = "myfile.sss"; if(Paths.get(file).toFile().isFile()){ //...do somethinh }