View Single Post
  #2 (permalink)  
Old 11-01-2009, 05:14 PM
travishein's Avatar
travishein travishein is offline
Senior Member
 
Join Date: Sep 2009
Location: Canada
Posts: 355
Rep Power: 1
travishein is on a distinguished road
Default
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;
    }
Reply With Quote