title: Change the directory of JFileChooser
body: <p>I want to remember the directory what user entered first time and then set the default directory to previously chosen directory. I am trying to do this by storing a static variable as path and pass it to JFileChooser, but its not working can you tell me why , please:</p>
  
  <pre><code> public class BrowseInputUI {
   public static String Path="";
   public BrowseInputUI() {
   JFileChooser fileopen = new JFileChooser(Path);//on second time user should see previous path
          int ret = fileopen.showDialog(null, "Provide a file");
          if (ret == JFileChooser.APPROVE_OPTION) {
            File file = fileopen.getSelectedFile();
                       Path=file.getPath();
           }
          else if (ret == JFileChooser.CANCEL_OPTION){
                Path=null;
          }
    }
  
    public String GetPath(){
           return Path;
       }
   }
  </code></pre>