well sure,
java.util.Formatter is only for working with the file name of the parameters you give it.
after you get the Formatter, you are pre-pending a locale onto the formatter path, so we also need to test if that file exists too.
|
Code:
|
Formatter fileFind = null;
try{
fileFind = new Formatter("CNDF.txt");
} catch (Exception e){
System.out.println("Cant find file");
e.printStackTrace();
return;
}
String path = Locale.getDefault()+"CNDF.txt";
if (!new File(path).exists()) {
System.out.println("Cant find file: " + path);
return;
} |