在Java读取文件或文件DOCX问题 [英] the problems with read Doc or Docx file in java

查看:260
本文介绍了在Java读取文件或文件DOCX问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个问题,读一本 .DOC .DOCX Java中的文件:

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

java.lang.NoClassDefFoundError的:组织/阿帕奇/ POI / HWPF / HWPFDocument

我不明白为什么这种情况正在发生和将AP preciate任何帮助摆脱这种错误。

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

推荐答案

嗯,这听起来好像你还没有把相关的Apache POI jar文件(S)到你正在使用在执行时的类路径。没有更多的信息,那就是所有我们能说的。

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.


  • 找到了需要哪些jar文件

  • 找到了什么控制classpath中(这将取决于你正在运行什么样的应用程序)

  • 确保所有jar文件的的到位

  • 重新运行

  • 利润:)

例如,在命令行,在Windows上,您可能需要运行:

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

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

(更换适当的jar文件名和您的入口点的名字。)

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

这篇关于在Java读取文件或文件DOCX问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆