I am developing an indexing system with Unicode (English, German, devanagari,
cyrillic, and special characters (certain characters such as ā, ī, ū, ṣ, ṭ, ḍ,
ṇ, ṝ, ṅ, ś, ṁ, etc)). I have no problems with the database and the Swing
windows are developed. I only wish to read one Word file during execution of
the application. I would like to have the software recognize certain strings
(both concrete and patterns via grep) rather than my tediously using drag and
drop. Thus, I have tried unsuccessfully to integrate Apache POI into
NetBeans. I downloaded poi-svc-3.9-20121203.zip, unzipped it into
C:\unzipped\poi-src-3.9-20121203 and placed that string in the Windows
CLASSPATH environment variable. I have also tried, again in failure, other
approaches.
I am running Windows Vista Ultimate with Service Pack 2, Java, NetBeans 7.0.1
and PostgreSQL.
Thanks for any help.
The following is the code:
import java.io.*;
import org.apache.poi.hwpf.HWPFDocument; \\ It cannot find this nor the
following.
import org.apache.poi.hwpf.extractor.WordExtractor;
public class ReadDocFile2
{
public static void main(String[] args)
{
File file = null;
WordExtractor extractor = null;
try {
file = new File("c:\\New.doc");
FileInputStream fis = new FileInputStream(file.getAbsolutePath());
HWPFDocument document = new HWPFDocument(fis);
extractor = new WordExtractor(document);
String[] fileData = extractor.getParagraphText();
for (int i = 0; i < fileData.length; i++) {
if (fileData[i] != null) {
System.out.println(fileData[i]);
}
}
} catch (Exception exep) {
}
The error is:
java.lang.ExceptionInInitializerError
Caused by: java.lang.RuntimeException: Uncompilable source code - package
org.apache.poi.hwpf does not exist
at ui.ReadDocFile2.<clinit>(ReadDocFile2.java:10)
Exception in thread "main" Java Result: 1
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]