title: FileOutputStream generated but can't be downloaded
body: <p>I have a generated an Excel file using this code:</p>
  
  <pre><code>try {
     FileOutputStream out = new FileOutputStream(new File("D:\\new1.xls"));
     workbook.write(out);
     out.close();
     System.out.println("Excel written successfully..");
  }
  </code></pre>
  
  <p>So how can I download it after this file is written?</p>
  
  <p><strong>UPDATE1:</strong></p>
  
  <p>I'm not using servlet. I'm using struts2, and this class, to generate my Excel file with poi.jar .</p>
  
  <pre><code>public class ExportToExcel{
  
      public void execToexcel() {
          HSSFWorkbook workbook = new HSSFWorkbook();
          HSSFSheet sheet = workbook.createSheet("Sample sheet");
  
          Map&lt;String, Object[]&gt; data = new HashMap&lt;String, Object[]&gt;();
          data.put("1", new Object[] {"Emp No.", "Name", "Salary"});
          ...
          }
          }
  
          try {
              FileOutputStream out = 
                      new FileOutputStream(new File("D:\\new1.xls"));
              workbook.write(out);
              DownloadManager.downloadFile("out");
              //out.flush();
              // Runtime.getRuntime().exec("new1.xls"); 
              out.close();
              System.out.println("Excel written successfully..");
  
          } catch (FileNotFoundException e) {
              e.printStackTrace();
          } catch (IOException e) {
              e.printStackTrace();
          }
      }
  }
  </code></pre>