title: Instead of rewrite new file is created
body: <p>I'm trying to write to a file which is already exists. As far as i have seen on forums this code should rewrite the old file but instead of rewrite it puts the file name into [] brackets and creates a new one. Any idea?</p>
  
  <pre><code> try {
     File file = new File("/home/erik/glassfish3/" + selectedMss + ".ini");
     BufferedWriter output = new BufferedWriter(new FileWriter(file));
     for (String newline : content) {
       output.write(newline + "\n");
     }
     output.close();
   } catch (IOException e) {
     e.printStackTrace();
   }
  </code></pre>