The file size is about 5M(see the attachment below),but when invoke the method: XSSFWorkbook workbook = new XSSFWorkbook(File file) , java.lang.OutOfMemoryError: Java heap space occurred.
Created attachment 38564 [details] The excel file mentioned above
Reading a large xlsx file requires a lot of memory. Try increasing your Xmx size. There is also support for streaming the Excel data - see https://poi.apache.org/components/spreadsheet/how-to.html and the 'XSSF and SAX (Event API)' section in it. There are external libs for stream reading that might be easier to use: * https://github.com/pjfanning/excel-streaming-reader * https://github.com/dhatim/fastexcel