title: Buffered Writer .write not writing to file
body: <p>This code is not writing to the file and I am unable to find why.</p>
  
  <pre><code>File file = DirectoryChooser.showDialog(fxcontroller.getPrimaryStage());
  if (file != null) {
      BufferedWriter bw; 
      try {
          File defaultMusicPath = new File("../defaultMusicPath.txt");
          bw = new BufferedWriter(new FileWriter(defaultMusicPath,true));
          bw.write(file.getAbsolutePath());
          System.out.println("done");
          bw.close();
      } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
  </code></pre>
  
  <p>This image shows the location of defaultMusicPath.txt</p>
  
  <p><a href="https://i.stack.imgur.com/8vxSO.png" rel="nofollow noreferrer">https://i.stack.imgur.com/8vxSO.png</a></p>
  
  <p>This image if you look at the bottom shows that file.getAbsolutePath() is not null</p>
  
  <p><a href="https://i.stack.imgur.com/lKZU9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lKZU9.png" alt="enter image description here"></a></p>
  
  <p>Following what someone else said, I have made a minimum verifiable example here.<br>
  I simplified it and it still is not working in writing to a file:</p>
  
  <pre><code>BufferedWriter bw;
  File defaultMusicPath = new File("../defaultMusicPath.txt");
  try {
      bw = new BufferedWriter(new FileWriter(defaultMusicPath,true));
      bw.write("it should write this");
  
      bw.flush();
      bw.close();
      System.out.println("done");
  } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
  }
  </code></pre>