Bug 10307

Summary: Invalid class file format:
Product: POI Reporter: Imron <sdc-tmsd2>
Component: HSSFAssignee: POI Developers List <dev>
Status: CLOSED FIXED    
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: Other   
OS: Solaris   

Description Imron 2002-06-28 03:03:47 UTC

I always got "Invalid class file format:" error during compilation
I didn't get any error message when "jakarta-poi-1.5.1-final-bin.tar.gz" 
downloaded from its site. has no problem with unzipped (#gzip -d filename).
To open the archive I used 
#tar xvfi jakarta-poi-1.5.1-final-bin.tar.gz
since always encounter checksum error I use "xvfi".

Therefore I rename the file to make my CLASSPATH simpler...
then I compile... and got the error... as shown below...

I tried to build my own poi*.jar, but seemed too complicated to me
as I know it needs another product "ant" ???

hope it clear enough...

Thanks in advance...

Detail as follow:
# CLASSPATH=/usr/imron/wjava:/usr/imron/wjava/poi.jar:.
# export CLASSPATH
# javac HSSFTest1.java
error: Invalid class file format: /usr/imron/wjava/poi.jar(org/apache/poi/hssf/u
sermodel/HSSFWorkbook.class), wrong version: 46, expected 45
HSSFTest1.java:47: Class org.apache.poi.hssf.usermodel.HSSFWorkbook not found in
 type declaration.
        HSSFWorkbook wb = new HSSFWorkbook();
HSSFTest1.java:47: Class org.apache.poi.hssf.usermodel.HSSFWorkbook not found in
 type declaration.
        HSSFWorkbook wb = new HSSFWorkbook();
3 errors
# more HSSFTest1.java
//package wroxbeans;

import java.io.*;
import java.util.Date;
import org.apache.poi.hssf.usermodel.*;
import java.lang.*;

public class HSSFTest1 {

    private String dirName;
    private String fileName;
    private String mailAddress;
    private String dummyData;
    private String defDummyData;
    private String slash;

    public HSSFTest1() {
        dirName = "d:";
        fileName = "HSSFTest1.xls";
        slash = "\\";
        mailAddress = "sdc-tmsd2@fujitsu.co.id";
        dummyData = "Dummy created on " + new Date();
        defDummyData = "default Dummy created on " + new Date();

    public void setDirName(String dName) {
        dirName = dName;
    public void setFileName(String fName) {
        fileName = fName;
    public void setMailAddress(String mAddr) {
        mailAddress = mAddr;
    public void setDummyData(String dData) {
        dummyData = dData;
        if (dData == null || dData.equals(""))
            dummyData = defDummyData;

    public void setSlash(String sl) {
        slash = sl;

    public synchronized void generateExcel() {
        // create work book
        HSSFWorkbook wb = new HSSFWorkbook();
        // create sheets
        HSSFSheet sheet1 = wb.createSheet("New Sheet!!!");
        HSSFSheet sheet2 = wb.createSheet("Second Sheet!!!");
        // get row
        HSSFRow row = sheet1.createRow((short)0);
        // get cell and put value in it
        HSSFCell cell = row.createCell((short)0);

        // writing to file
        try {
            FileOutputStream fileOut = new FileOutputStream(dirName + slash + fi
        }catch(IOException e) {
Comment 1 Natasha Marell 2002-07-03 20:21:52 UTC
Check your compiler! Symantec 3 can cause this problem.

Comment 2 Andy Oliver 2002-07-15 00:48:23 UTC
did you try ./build.sh compile ?
Comment 3 Glen Stampoultzis 2002-07-21 03:39:29 UTC
No response.  Closing.
Comment 4 Glen Stampoultzis 2002-07-21 03:40:39 UTC
No response.  Closing.