0

Hi I am having an error when I try to use the HSSF Workbook. See this error

Exception in thread "Thread-13" java.lang.NoClassDefFoundError: org/apache/poi/hssf/usermodel/HSSFWorkbook
    at digicare.tracking.serial.BulkUpload.UploadProgress$1read2.run(UploadProgress.java:95)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.apache.poi.hssf.usermodel.HSSFWorkbook
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)

Here's my code:

try {
    file = new FileInputStream(new File(FilePath));
    try {
        workbook = new HSSFWorkbook(file);
    } catch (Exception e2){
        JOptionPane.showMessageDialog(null, "Error1" + e2.getMessage());
    }

    //HSSFSheet sheet = workbook.getSheetAt(0);
    //HSSFRow row;
    //HSSFCell cell;  
} catch (FileNotFoundException e1) {
// TODO Auto-generated catch block
      JOptionPane.showMessageDialog(null, "Error1" + e1.getMessage()); 
} catch (IOException e) {
// TODO Auto-generated catch block
      JOptionPane.showMessageDialog(null, "Error2 "+ e.getMessage()); 
}

It seems like whenever I try to use the workbook part it returns an error

Bimbz
  • 443
  • 2
  • 5
  • 18

1 Answers1

0

Do you have the POI jars in your build path.It says No class found.HSSF is associated with XLS files.

See here for an example in Eclipse.

Depending on which IDE you use, the setup process might vary.

Community
  • 1
  • 1
Madusudanan
  • 1,017
  • 1
  • 15
  • 36
  • yeah I have all the POI jar files. last time I used the POI it worked fine, that is web application. but this one is a java web start application and now its not working. – Bimbz Sep 13 '13 at 07:23
  • If it was working previously,you might want to track down what was the recent change you made.Are you using any build tool for your application? – Madusudanan Sep 13 '13 at 07:36
  • it worked before in a web application. I am now using it on a web-start application. is the implementation of poi the same in web-start applications? – Bimbz Sep 13 '13 at 07:39
  • Yes,its the same.It does not have to do with what application you use in the front end,it is just a third party library.What exactly is your use case here,the excel is getting uploaded from the front end? – Madusudanan Sep 13 '13 at 07:45
  • yes excel is being uploaded from front end. Now my eclipse is also not working. it hangs on start up – Bimbz Sep 13 '13 at 08:12