title: Save Excel file to Windows via Weblogic Server?
body: <p>I have created a Maven project and written a Servlet which uses the Apache POI to save an excel spreadsheet. When I deploy the project as a WAR onto a Weblogic Server and run it. It doesn't save the excel sheet to the windows location specified. How can I save the excel sheet to a windows location from Weblogic server?</p>
  
  <pre><code>public class excelGenerator extends HttpServlet{
  
   /**
       * 
       */
      private static final long serialVersionUID = 1L;
  protected void doGet(HttpServletRequest request,
              HttpServletResponse response) throws ServletException, IOException {
          doPost(request, response);
  
      }
      protected void doPost(HttpServletRequest request,
              HttpServletResponse response) throws ServletException, IOException {
                      HSSFWorkbook workbook = new HSSFWorkbook();
                  HSSFSheet sheet = workbook.createSheet("Sample sheet");
  
                  // Create a new row in current sheet
                  Row row = sheet.createRow(0);
                  // //Create a new cell in current row
                  Cell cell = row.createCell(0);
                  // //Set value to new value
                  cell.setCellValue("Blahblah");
  
                  FileOutputStream out = new FileOutputStream(new File("C:\\Users\\User1\\Desktop\\work\\excel.xls"));
                  workbook.write(out);
                  out.close();
                  System.out.println("Excel written successfully..");
      }
  
  }
  </code></pre>