views:

365

answers:

1

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.

+1  A: 

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_D
Thank u! But what here the 'xxx' means?
Supereme
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