the problems with read Doc or Docx file in java [closed]

ⅰ亾dé卋堺 提交于 2019-12-04 07:05:24

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/12499372/the-problems-with-read-doc-or-docx-file-in-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!