嗨大家我试图使用此代码在JFrame中显示Excel工作表页面
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);
但我收到了错误:
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
我的ClassPath中有以下Jar:jexcel-1.5.23878.jar。请帮忙。