I have an application that I'm deploying with Java Web Start. When I was doing unit testing, I noticed a slight problem: whenever my application is run with Java Web Start, a particular operation takes a long time to execute. When run locally, however, it is quite fast.
The particular operation I'm talking about is reading in a large (5k row) Excel file to parse it. This is the line of code:
Workbook wb = WorkbookFactory.create(new FileInputStream(new File(inputFile.getText())));
To figure out the problem, I added a way to record the time:
long time1 = System.currentTimeMillis();
Workbook wb = WorkbookFactory.create(new FileInputStream(new File(inputFile.getText())));
long time2 = System.currentTimeMillis();
long diff = time2 - time1;
double seconds = (double)diff / (double)1000;
DecimalFormat df = new DecimalFormat("#,##0.00");
System.out.println("Elapsed Time: " + df.format(seconds) + " seconds.");
And this is the ouput:
(local)
Elapsed Time: 4.83 seconds.
(Java Web Start)
Elapsed Time: 35.52 seconds.
BUT THEN, an immediate subsequent run (on Java Web Start) yields this:
Elapsed Time: 1.61 seconds.
My suspicion is that this has to do with the POI library (in particular, the size of the library required to read POI, more specifically, the 13 MB ooxml-schemas-1.0.jar
library file). So, my question is: assuming it is the library size, is there any way to prevent this? I have library caching turned on through the control panel, so why does it seem to need to be caching the library? Once it is loaded, it's fast. But it takes forever the first time.
Here's an image of the control panel showing that I am allowing it to store the libraries:
Has anyone seen this kind of behavior before? No SSCCE because... well, how do you post an SSCCE with a Java Web Start question?