Error in displaying a doc file reading that from a document on console in java
<p>I tried to display the data from a doc file on console then i got this error</p>

<pre><code>run:
The document is really a RTF file
Exception in thread "main" java.lang.NullPointerException
    at DocReader.readDocFile(DocReader.java:36)
    at DocReader.main(DocReader.java:47)
Java Result: 1
BUILD SUCCESSFUL (total time: 4 seconds)
</code></pre>

<p>can any one explain where i went wrong</p>

<p>the code is
        import java.io.File;
    import java.io.FileInputStream;</p>

<pre><code>import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.extractor.WordExtractor;
public class DocReader {
public void readDocFile() {
File docFile = null;
WordExtractor docExtractor = null ;
WordExtractor exprExtractor = null ;
try {
docFile = new File("C:\\web.doc");

FileInputStream fis=new FileInputStream(docFile.getAbsolutePath());


HWPFDocument doc=new HWPFDocument(fis);

docExtractor = new WordExtractor(doc);
}
catch(Exception exep)
{
System.out.println(exep.getMessage());
}


String [] docArray = docExtractor.getParagraphText();

for(int i=0;i&lt;docArray.length;i++)
{
if(docArray[i] != null)
System.out.println("Line "+ i +" : " + docArray[i]);
}
}

public static void main(String[] args) {
DocReader reader = new DocReader();
reader.readDocFile();
}
}
</code></pre>
