You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by lw <wu...@hotmail.com> on 2012/11/13 20:28:18 UTC

java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/Workbook

Hi, I'm new to POI. I downloaded poi-3.8 and tried to read a .xlsx file.
However, even the simplest code causes below error when I run it even I can
compile it successfully. I'm afraid I missed some important part. Which part
i did wrong? I struggled with it for a while already. Your help is highly
appreciated! BTW, I'm using 64 bit Windows 7. I'm using Java 1.7.0_09-b05.

Here is my very simple code:

import java.io.*;
import org.apache.poi.ss.usermodel.*;

public class Test {
 public static void main(String[] args) throws IOException  {
    File file = new File("example_tables.xlsx");
	try {
		Workbook workbook = WorkbookFactory.create(file);
	}
	catch (Exception e) {e.getMessage();}
 }
}


Here is the error I got when I run it.

Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/poi/ss/usermodel/Workbook
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
        at java.lang.Class.getMethod0(Unknown Source)
        at java.lang.Class.getMethod(Unknown Source)
        at sun.launcher.LauncherHelper.getMainMethod(Unknown Source)
        at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException:
org.apache.poi.ss.usermodel.Workbook
        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 java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 6 more



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/java-lang-NoClassDefFoundError-org-apache-poi-ss-usermodel-Workbook-tp5711477.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org