0

I want to read an xlsx file using api XSSF. For that I downloaded poi-3.6 api and then did set the correct classpath but then too when I run my program I get an Exception as in thread "main" java.lang.NoClassDefFoundError: org/apache/poi/xssf/usermodel/XSSFWorkbook

But I can read xls file using HSSF api without any exception.

skaffman
  • 398,947
  • 96
  • 818
  • 769
Supereme
  • 2,379
  • 12
  • 46
  • 67

1 Answers1

4

java.lang.NoClassDefFoundError is always a classpath issue: java can't find the class org/apache/poi/xssf/usermodel/XSSFWorkbook on the classpath while executing your main method.

The class is inside the poi-ooxml-3.6-xxx.jar. Double check if this lib is really on the classpath.

Andreas Dolk
  • 113,398
  • 19
  • 180
  • 268
  • Thank u! But what here the 'xxx' means? – Supereme Jan 15 '10 at 04:13
  • I've given the classpath as 'C:\poi-3.6\poi-ooxml-3.6\20091214.jar' as I've poi-3.6 on C drive. Then I compiled using command 'javac -Xlint -classpath C:\poi-3.6\poi-ooxml-3.6-20091214.jar Excell7.java'. It got compiled successfully. After that I tried to run using command 'java -cp C:\poi-3.6\poi-ooxml-3.6-20091214.jar; . Excell7' then I got exception as 'Exception thread in "main" java.lang.NoClassDedfFoundError:/, What could be the reason? – Supereme Jan 15 '10 at 04:58
  • @Supereme Please advice as how you resolve the problem, as I am struggling with the same problem. – Sunil Sep 08 '16 at 13:08