title: POI - Cannot write to file while it is opened in Excel?
body: <p>I'm new on the website. I try to write to an excel file while it is opened (using POI / JAVA).</p>
  
  <p>I got a <code>java.io.FileNotFoundException</code> error when i attempt to create a file output stream to write to the file. </p>
  
  <p><code>FileOutputStream</code> didn't work. I receive this following message: </p>
  
  <blockquote>
    <p>the process cannot access the file because it is being used by another
    process.</p>
  </blockquote>
  
  <pre><code>         try {
             FileOutputStream fileOut;
             XSSFWorkbook wb = new XSSFWorkbook(new FileInputStream("Classeur.xlsm")); 
             ...
             ...
             fileOut = new FileOutputStream("Classeur.xlsm");
             wb.write(fileOut);
             fileOut.close();
             }
          catch (FileNotFoundException e){
             e.printStackTrace();
             } 
          catch (IOException e) {
             e.printStackTrace();
             }
  </code></pre>
  
  <p>Does anybody know how i can fix it? i'm writting an (POI-Java-Swing) application to dynamically read/write in excel files. </p>
  
  <p>Thanks for your help</p>