Reputation: 2597
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
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
Upvotes: 0
Views: 2011
Reputation: 4252
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, 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, 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:
References: Java class file
Upvotes: 4