getResourceAsStream() can't find spreadsheet (I think)

K

khutch

Hope someone can help. I'm using Visual Age for Java 3.5.3. In my code
I have the following in a main() method:

InputStream input = POIExample.class.getResourceAsStream( "qa.xls" );
POIFSFileSystem fs = new POIFSFileSystem( input );

(see link: http://www.javaworld.com/javaworld/javaqa/2002-05/01-qa-0503-excel3.html
for full program)

where POIExample is the class in which I'm running the code. As you
can see I'm trying to get a handle on the spreadsheet qa.xls which is
held in the root of my C:\ directory (C:\qa.xls). On running the
main() method I get an error:

Uncaught exception (java.lang.NoClassDefFoundError:eek:rg.apache.poi.poifs.filesystem.POIFSFileSystem)

when I get to the second line of the above code. The class is indeed
imported with the statement:

import org.apache.poi.poifs.filesystem.POIFSFileSystem

so I guess its not finding the qa.xls spreadsheet. Any ideas?
Thanx
 
K

khutch

Found the Problem: even though the pacakge was imported, it still
needed to be declaraed within the classpath. Problem solved
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top