java.lang.OutOfMemoryError: Java heap space while reading excel with Apache POI

前端 未结 6 1492
渐次进展
渐次进展 2020-12-01 06:46

My file is 9MB and I got this error while loading workbook.

XSSFWorkbook workbook = new XSSFWorkbook(excelFilePath); 

this

6条回答
  •  醉酒成梦
    2020-12-01 07:28

    As suggested by others the first thing to do is to increase the heap size.

    If that does not help or you expect larger files you should also take a look at this answer: Processing large xlsx file in Java

    It gives a few good starting points on what can be done if the standard "read everything" mode is not working for you.

提交回复
热议问题