0
嗨,大家好,我嘗試使用此代碼打開Excel使用Jexcel
JFrame frame = new JFrame();
Container cp = frame.getContentPane();
cp.setLayout(new BorderLayout());
File workbookFile = new File("C:\\Workbook.xls");
//Opening the specified file in the JWorkbook component
JWorkbook jWorkbook = new JWorkbook(workbookFile);
cp.add(jWorkbook);
顯示在JFrame中一個Excel工作表的頁面,但我得到的錯誤:
Exception in thread "main" java.lang.NoClassDefFoundError: com/jniwrapper/win32/automation/OleContainer
at excel.open.ExcelOpen.main(ExcelOpen.java:29)
Caused by: java.lang.ClassNotFoundException: com.jniwrapper.win32.automation.OleContainer
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 1 more
Java Result: 1
在我有以下的Jar我的ClassPath:jexcel-1.5.23878.jar。請幫忙。