Apache POI を使用して単純なワークブックを作成しようとしていますが、次のエラーが発生します。
エラー:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xmlbeans/XmlException
at xlscreate.xlsclass.main(xlsclass.java:24)
Caused by: java.lang.ClassNotFoundException: org.apache.xmlbeans.XmlException
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)
... 1 more
コード:
import java.io.FileOutputStream;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.io.InputStream;
public class xlsclass {
public static void main(String[] args) throws Exception,Throwable{
// Workbook wb = new HSSFWorkbook();
// FileOutputStream fileOut = new FileOutputStream("workbook.xls");
// wb.write(fileOut);
// fileOut.close();
Workbook wb = new XSSFWorkbook();
FileOutputStream fileOut = new FileOutputStream("c:/workbook.xlsx");
wb.write(fileOut);
fileOut.close();
}
}