Hello,
1) I just downloaded poi-bin-3.6-20091214.zip to my Windows XP PC.
2) I unzipped the file into C:\Program Files\Java\ so there is now a
poi-3.6 folder
3) I added the following two entries to my CLASSPATH:
C:\Program Files\Java\poi-3.6\poi-ooxml-3.6-20091214.jar
C:\Program Files\Java\poi-3.6\poi-ooxml-schemas-3.6-20091214.jar
4) I rebooted my PC
5) Here is my code snippet:
import org.apache.poi.xssf.usermodel.*;
...
try
{
XSSFWorkbook wb = new XSSFWorkbook("C:\\MyWorksheet.xlsm");
XSSFSheet s1 = wb.getSheet("Sheet1");
XSSFSheet s2 = wb.getSheet("Sheet2");
JOptionPane.showMessageDialog(
this, "PhysicalNumberOfRows = " +
s1.getPhysicalNumberOfRows());
JOptionPane.showMessageDialog(
this, "LastRowNum = " + s1.getLastRowNum());
JOptionPane.showMessageDialog(
this, "PhysicalNumberOfRows = " +
s2.getPhysicalNumberOfRows());
JOptionPane.showMessageDialog(
this, "LastRowNum = " + s2.getLastRowNum());
}
catch (Throwable e)
{
JOptionPane.showMessageDialog(
null, e.toString(), "Read Error",
JOptionPane.ERROR_MESSAGE);
}
6) When I compile with the command javac MyApp.java I don't get any
errors.
7) When I run my applet using IE (version 6) the following exception is
caught:
java.lang.NoClassDefFoundError:
org/apache/poi/xssf/usermodel/XSSFWorkbook
What have I forgotten to do to get apache poi working on my PC?
Thomas
|