I have a large word document (over 10,000 lines) containing a table of information which must be converted to excel using Java. I am using apache poi to extract the table and to save it to excel. I have the following code and it functions on a subset of rows on an iMac. However, I get a Heap Space exception when running the code on the full document: