• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Write Huge Excel file (.Xlsx) POI and Java - java.lang.OutOfMemoryError: Java heap space

 
Julio leopard banderas
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,
I'm looking for solution to write an excel file (.Xlsx) with data from database,

For example :
----------------

Code to write Xlsx file:
--------------------------


But this code give me an ERROR :


I found a solution in http://www.coderanch.com/t/424181/open-source/Read-xls-xlsx-file-format
it work verry fine but ionly for reading huge Excel file

Thanks
 
Olivier Rihoux
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just USE SXSSF components that keeps only small part of your file in memory

 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unless the "55555" is an actual number (and not just for testing) you could also try bumping up the JVM memory. Its default allocation is a LOT smaller than what most desktops and servers have available in unused memory.

Using Oliver's approach will probably give you more peace of mind, though :-)
 
Meer Nasirudeen
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone... I too faced the same issue of OOM while parsing xlsx file...after two days of struggle, I finally found out the below code that was really perfect;

This code is based on sjxlsx. It reads the xlsx and stores in a HSSF sheet.



 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic