在XML构建文件的Java程序使用Apache POI 3.9出现的错误 [英] Java program using apache poi 3.9 encountered error in XML build file

查看:1008
本文介绍了在XML构建文件的Java程序使用Apache POI 3.9出现的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

喜遇到构建以XML错误。从日志我认为错误与Apache POI库POI-OOXML-3.9-20121203以及有关的Java版本。
我目前使用的JDK 4和Apache POI 3.9。

Hi encountered an error in build xml. From the log i think that the error is with apache poi library "poi-ooxml-3.9-20121203" and regarding Java versions. I am currently using JDK 4 and apache poi 3.9.

Buildfile: C:\POITest\build.xml
    init:
    clean:
       [delete] Deleting directory C:\POITest\build
       [delete] Deleting directory C:\POITest\dist
    init:
        [mkdir] Created dir: C:\POITest\dist
        [mkdir] Created dir: C:\POITest\build
        [mkdir] Created dir: C:\POITest\dist\lib
    compile:
        [javac] C:\POITest\build.xml:38: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
        [javac] Compiling 1 source file to C:\POITest\build
        [javac] C:\POITest\src\poi\test\TestMain.java:8: cannot access org.apache.poi.openxml4j.exceptions.InvalidFormatException
        [javac] bad class file: C:\POITest\lib\poi3-9\poi-ooxml-3.9-20121203.jar(org/apache/poi/openxml4j/exceptions/InvalidFormatException.class)
        [javac] class file has wrong version 49.0, should be 48.0
        [javac] Please remove or make sure it appears in the correct subdirectory of the classpath.
        [javac] import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
        [javac]                                            ^
        [javac] 1 error

POI JAR的列表

List of POI JARS

/POITest/lib/poi3-9/commons-codec-1.5.jar
/POITest/lib/poi3-9/commons-logging-1.1.jar
/POITest/lib/poi3-9/dom4j-1.6.1.jar
/POITest/lib/poi3-9/junit-3.8.1.jar
/POITest/lib/poi3-9/log4j-1.2.13.jar
/POITest/lib/poi3-9/poi-3.9-20121203.jar
/POITest/lib/poi3-9/poi-examples-3.9-20121203.jar
/POITest/lib/poi3-9/poi-excelant-3.9-20121203.jar
/POITest/lib/poi3-9/poi-ooxml-3.9-20121203.jar
/POITest/lib/poi3-9/poi-ooxml-schemas-3.9-20121203.jar
/POITest/lib/poi3-9/poi-scratchpad-3.9-20121203.jar
/POITest/lib/poi3-9/stax-api-1.0.1.jar
/POITest/lib/poi3-9/xmlbeans-2.3.0.jar

只要让我知道如果你需要看到构建文件。
谁能告诉我什么,我需要做什么来解决这个问题。谢谢

Just let me know if you need to see the build file. Can anyone tell me what I need to do to solve this. Thanks

推荐答案

49.0和48.0的类文件格式的版本号。该错误消息意味着POI-3.9编译到JDK 5类文件格式,你想用它来与JDK 4.当然,JDK 4不能支持JDK 5类文件格式。我觉得你可以试试旧版本的POI。或者只是使用JDK 5。

49.0 and 48.0 are the version number of the class file format. The error message means that POI-3.9 was compiled to JDK 5 class file format and you tried to use it with JDK 4. Of course, JDK 4 couldn't support JDK 5 class file format. I think you can try older version POI. Or just use JDK 5.

1,从POI 3.5,它需要JDK 1.5。所以,你可以使用POI 3.4。详情请参阅这篇文章:的Apache POI的JDK版本

1, From POI 3.5, it requires JDK 1.5. So you can use POI 3.4. Please refer to this post: Apache POI JDK version.

2,有人已经迁移POI 3.8到JDK 1.4。检查的Apache POI(3.8决赛)迁移到JDK 1.4 。要谨慎使用非二进制官方。它可能不全面测试。

2, Someone has already migrated POI 3.8 to JDK 1.4. Check Apache POI (3.8 final) migrated to JDK 1.4. Be caution to use non-offical binary. It might not test fully.

所使用的类文件格式的主版本号

Major version number of the class file format being used:


  • J2SE 7 = 51(0x33十六进制)

  • J2SE 6.0 = 50(0x32十六进制)

  • J2SE 5.0 = 49(0X31十六进制)

  • JDK 1.4 = 48(十六进制的0x30)

  • JDK 1.3 = 47(十六进制值为0x2F)

  • JDK 1.2 = 46(0x2E之间十六进制)

  • JDK 1.1 = 45(0x2D十六进制)

参考: Java类文件

这篇关于在XML构建文件的Java程序使用Apache POI 3.9出现的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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