在編譯xml時遇到錯誤。從日誌中我認爲錯誤是與apache poi庫「poi-ooxml-3.9-20121203」和Java版本有關。 我目前正在使用JDK 4和apache poi 3.9。 POI罐子使用apache poi的Java程序3.9在XML構建文件中遇到錯誤
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
列表
/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
只要讓我知道如果你需要看到構建文件。 任何人都可以告訴我我需要做什麼來解決這個問題。謝謝
這個錯誤意味着POI3使用JDK 5編譯,並嘗試與JDK 4.使用它,它不會起作用。 – longhua 2013-03-12 03:18:10