This week's book giveaway is in the Agile forum.
We're giving away four copies of Head First Agile and have Andrew Stellman & Jennifer Greene on-line!
See this thread for details.
Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Reading Spreadsheets with JExcelApi  RSS feed

 
Rudy Rodriguez
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am using JExcel to read Excel spreadsheets, in a Java application.

The program is opening a workbook, and reads the names of the sheets in the workbook.
I use a while loop to read through the sheets.

I created several workbooks with Identical sheet names.

My program is having problems reading a certain workbook. I get the following runtime error, when I try to read a certain workbook.
I am using Netbeans IDE, It seems that the sheet is large and is triggering a Out of Memory error.

How can I increase the memory in the Netbean editor to fix this.

Or is there another method to fix my problem.


Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
at jxl.read.biff.File.read(File.java:217)
at jxl.read.biff.Record.getData(Record.java:117)
at jxl.read.biff.CellValue.<init>(CellValue.java:94)
at jxl.read.biff.RKRecord.<init>(RKRecord.java:66)
at jxl.read.biff.SheetReader.read(SheetReader.java:419)
at jxl.read.biff.SheetImpl.readSheet(SheetImpl.java:716)
at jxl.read.biff.WorkbookParser.getSheet(WorkbookParser.java:252)


Thanks
Rudy
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
NetBeans is an IDE; it shouldn't be used to run production code. What happens if you run it outside of NetBeans and increase the memory with the -Xmx switch?
 
Radhakrishnan Ranjit
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In JXL you have got API methods to set the initial size and grow size.

public void setArrayGrowSize(int sz)
public void setInitialFileSize(int sz)


This would help you to tackle the out of memory issue, cause by default JXL tries to allocate 5 MB when invoked which could be an overhead in majority of the cases.

 
Campbell Ritchie
Marshal
Posts: 55799
164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not a beginner's question. Moving.
 
Rudy Rodriguez
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All

I was able to correct the problem by increasing the size of my virtual memory in the IDE.

Thanks

Rudy
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!