user1683695
user1683695

Reputation: 1

the problems with read Doc or Docx file in java

I am having this problem with reading a .doc or .docx file in Java:

java.lang.NoClassDefFoundError: org/apache/poi/hwpf/HWPFDocument

I don't understand why this is happening and would appreciate any help getting rid of this error.

Upvotes: -3

Views: 796

Answers (1)

Jon Skeet
Jon Skeet

Reputation: 1499660

Well, that sounds like you haven't put the relevant Apache POI jar file(s) into the classpath you're using at execution time. Without more information, that's about all we can say.

  • Find out which jar files are required
  • Find out what's controlling your classpath (which will depend on what kind of app you're running)
  • Make sure all the jar files are in place
  • Rerun
  • Profit :)

For example, from the command line, on Windows, you might want to run:

java -cp .;poi-whatever.jar foo.bar.Test

(Replace the jar file name and your entry point name appropriately.)

Upvotes: 2

Related Questions