[Building Sakai] How to Using POI library in Sakai project?
Adrian Fish
a.fish at lancaster.ac.uk
Mon Mar 5 02:08:30 PST 2012
Hi Bao,
Find the jars in your local maven repository and run jar -tf against
them to list the classes.
A command like this ...
jar -tf poi-3.7-20101029.jar | grep DirectoryNode
.. will tell you if that class is in the jar.
That's the first thing I'd try as you may not be pulling in the correct
POI jar.
Your local maven repo is usually under <HOMEDIR</.m2/repository
Cheers,
Adrian.
On 05/03/2012 09:01, Tram Bao wrote:
> Dear all,
> I've use POI library in my project. POI library consist 3 package:
> poi-3.7-20101029.jar; poi-ooxml-3.7-20101029.jar;
> poi-scratchpad-3.7-20101029.jar
> I add dependency in pom.xml:
>
> <dependency>
> <groupId>poi</groupId>
> <artifactId>poi</artifactId>
> <version>3.7-20101029</version>
> </dependency>
> <dependency>
> <groupId>poi</groupId>
> <artifactId>poi</artifactId>
> <version>ooxml-3.7-20101029</version>
> </dependency>
> <dependency>
> <groupId>poi</groupId>
> <artifactId>poi</artifactId>
> <version>scratchpad-3.7-20101029</version>
> </dependency>
> but when I build project, it build failure:
> cannot access
> org.apache.poi.poifs.filesystem.DirectoryNode
> class file for
> org.apache.poi.poifs.filesystem.DirectoryNode not found
> HWPFDocument
> doc=new HWPFDocument(fis);
>
> This is my function:
>
> public String ReadDocToByte(String link)
> {
>
> //link="F:\\test.doc";
> byte []fileData=new byte[]{};
>
> WordExtractor ex=null;
> try
> {
>
> FileInputStream fis=new FileInputStream(link);
> HWPFDocument doc=new HWPFDocument(fis);
>
> fileData=doc.getDataStream();
>
> }
>
> catch (FileNotFoundException e)
> {
>
> e.printStackTrace();
> }
> catch (IOException e)
> {
>
> e.printStackTrace();
> }
> return fileData.toString();
> }
>
>
> This function is used to read a doc file.
>
> Please help me fix that error.
> Thanks all,
> BaoTram.
>
>
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>
> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of "unsubscribe"
--
==================================
Adrian Fish
Software Engineer
B66 Management School
Lancaster University
Lancaster
LA1 4YW
http://www.sakaiproject.org
http://confluence.sakaiproject.org/display/YAFT/Yaft
http://confluence.sakaiproject.org/display/CLOG/Home
http://confluence.sakaiproject.org/display/BBB/Home
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20120305/03ab8f84/attachment.html
More information about the sakai-dev
mailing list