【问题标题】:Read Word file in JAVA/GWT在 JAVA/GWT 中读取 Word 文件
【发布时间】:2014-05-07 15:30:00
【问题描述】:

我正在尝试读取一个 word 文件,然后将其存储在我的数据库中。 为此,我正在使用 APACHI POI

http://sanjaal.com/java/tag/java-and-docx-format/

我已经在构建路径中添加了所需的 jar,没有导入错误

但是当我运行/编译我的应用程序时,它会说:

            [ERROR] Line 22: No source code is available for type org.apache.poi.poifs.filesystem.POIFSFileSystem; did you forget to inherit a required module?
  [ERROR] Line 24: No source code is available for type java.io.FileInputStream; did you forget to inherit a required module?
  [ERROR] Line 25: No source code is available for type org.apache.poi.hwpf.HWPFDocument; did you forget to inherit a required module?
  [ERROR] Line 47: No source code is available for type org.apache.poi.hwpf.extractor.WordExtractor; did you forget to inherit a required module?
  [ERROR] Line 63: No source code is available for type org.apache.poi.hwpf.usermodel.HeaderStories; did you forget to inherit a required module?
  [ERROR] Line 77: No source code is available for type org.apache.poi.hpsf.DocumentSummaryInformation; did you forget to inherit a required module?

知道我错过了什么

谢谢

【问题讨论】:

    标签: java gwt apache-poi


    【解决方案1】:

    GWT 不是一个完整的 JVM——它是一个带有 Java 运行时环境子集的源预处理器,因此你不能随意使用你找到的任何 JAR。您将需要在服务器端进行所有处理和文本提取。

    【讨论】:

    • @junaidp 你应该接受这个答案,因为它实际上解释了为什么它不起作用。
    【解决方案2】:

    我认为这些 jar 不适合 GWT 客户端。因此,您只能在服务器端使用它们,而不是在客户端。

    【讨论】:

      【解决方案3】:

      我猜您在 GWT 应用程序的客户端使用了该库。在程序的这一部分中,您只能使用可以编译为 JavaScript 的 Java 类。而且 GWT 只能编译有限数量的 Java 类。此外,在 JavaScript(在客户端中使用)中打开文件是不可能的。在应用程序的服务器部分执行文件 I/O,并通过 RPC 或使用 requestfactory 传输内容。

      【讨论】:

        猜你喜欢
        • 2011-02-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-07-23
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多