I need help getting the Apache POI set up correctly. I downloaded this file: http://mirrors.devlib.org/apache/poi/release/bin/poi-bin-3.2-FINAL-20081019.tar.gz from poi.apache.org, and don't know what to do next?

Where do I put this file? Are there other files I need to download? I hear talk of setting a "Classpath". What is this, and how do I set it up?

I'm running Mac OSX and a current version of Eclipse (set up for Java).

The end result I'm looking for is to be able to execute the following code properly in Java:*

import org.apache.poi.poifs.filesystem.*;
import org.apache.poi.hwpf.*;	
import org.apache.poi.hwpf.extractor.*;
import java.io.*;
public class readDoc
	public static void main( String[] args )
		String filesname = "Hello.doc";
		POIFSFileSystem fs = null;
                  fs = new POIFSFileSystem(new FileInputStream(filesname; 
                  //Couldn't close the braces at the end as my site did not allow it to close
                  HWPFDocument doc = new HWPFDocument(fs);
		  WordExtractor we = new WordExtractor(doc);
		  String[] paragraphs = we.getParagraphText();
		  System.out.println( "Word Document has " + paragraphs.length + " paragraphs" );
		  for( int i=0; i<paragraphs .length; i++ ) {
			paragraphs[i] = paragraphs[i].replaceAll("\\cM?\r?\n","");
                	System.out.println( "Length:"+paragraphs[ i ].length());
                catch(Exception e) { 

*code was found online. The important parts of that include getting the import to work well so that the following methods and class references work as expected.

I'm a newbie to Java so I may need a bit more explanation on how to do some of the basics or what Java jargon means.


Recommended Answers

All 6 Replies

You need to extract this file and you will get 3 JAR files (poi-3.2-FINAL-20081019.jar, poi-contrib-3.2-FINAL-20081019.jar and poi-scratchpad-3.2-FINAL-20081019.jar, most of the times you will need only poi and poi-scratchpad) plus other documentation.
Then you have to attach it to your project like here

Amazing! Thanks!

That seems to have worked!

hi can you please tell me hoe you got the code you've mentioned to compile and run. Im using poi API for the first time. I need to convert powerpoint to image. Can you help me out with that?

1) Bad idea to reopen old thread
2) Little search and less excuses of being new and you would have found this code

Plz Give me a Link from Where To Download The APache POI for Creating and editing Excel Files through JAVA....

ive dwnloaded the zip files from various Sources but there is No jra file in those zip files.....

plz post the exact Link From where i can directly dwnload the file.....


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.