[Building Sakai] How to Using POI library in Sakai project?

baotram baotram144 at gmail.com
Mon Mar 5 19:01:09 PST 2012


Hi Adrian!
 three jars file in my local maven repository:
  .m2/repository/poi/poi/3.7-20101029/poi-3.7-20101029.jar
 .m2/repository/poi/poi/ooxml-3.7-20101029/poi-ooxml-3.7-20101029.jar
.m2/repository/poi/poi/scratchpad-3.7-20101029/poi-scratchpad-3.7-20101029.jar

I add dependency in pom.xml  right or wrong??:

<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>

Please help me about that error.
Thanks for your helping!
BaoTram.

Adrian Fish wrote:
> 
> 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
> 
> 
> _______________________________________________
> 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"
> 

-- 
View this message in context: http://old.nabble.com/-Building-Sakai--How-to-Using-POI-library-in-Sakai-project--tp33442005p33448400.html
Sent from the Sakai - Development mailing list archive at Nabble.com.



More information about the sakai-dev mailing list