JAVA - Out Of Memory Error while writing Excel Cells in jxl

前端 未结 2 1450
遥遥无期
遥遥无期 2021-01-16 06:04

I am using JXL to write an excel file of 50000 rows and 30 columns. My code looks like this:

for (int j = 0; j < countOfRows; j++) {

myWritableShe         


        
相关标签:
2条回答
  • 2021-01-16 06:23

    Is raising the memory available to the VM (with -Xms and -Xmx) not an option?

    0 讨论(0)
  • 2021-01-16 06:24

    The JExcel FAQ has a couple of suggestions including Curtis' idea above.

    If you don't mind the performance hit, you could use a temporary file instead of doing it all in memory.

    WorkbookSettings s = new WorkbookSettings();  
    s.setUseTemporaryFileDuringWrite(true);  
    WritableWorkbook ws = Workbook.createWorkbook(new File("someFile.xls"),s); 
    
    0 讨论(0)
提交回复
热议问题