sto ottenendo seguente errorejava.lang.ClassNotFoundException: org.apache.xmlbeans.XmlObject errore
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xmlbeans/XmlObject at OrderBook.WriteToExcelSheet.CreateOutPutFile(WriteToExcelSheet.java:20) at OrderBook.MainMethod.main(MainMethod.java:71)
ho cercato le ragioni di questo errore in linea, ma non riuscivo a trovare il motivo per cui sto ottenendo esso.
ho incluso i seguenti file jar
poi-3.9-20121203.jar,
poi-excelant-3.9-20121203.jar,
poi-examples-3.9-20121203.jar,
poi-ooxml-3.9-20121203.jar,
poi-ooxml-schemas-3.9-20121203.jar,
poi-scratchpad-3.9-20121203.jar
Codice:
public class WriteToExcelSheet {
public static Map < Integer, Object[] > data = new TreeMap < Integer, Object[] >();
public static void CreateOutPutFile() {
XSSFWorkbook workbook = new XSSFWorkbook();
XSSFSheet sheet = workbook.createSheet("Orderbook Stats");
//This data needs to be written (Object[])
//Iterate over data and write to sheet
Set <Integer> keyset = data.keySet()
int rownum = 0;
for (Integer key: keyset) {
Row row = sheet.createRow(rownum++);
Object[] objArr = data.get(key);
int cellnum = 0;
for (Object obj: objArr) {
Cell cell = row.createCell(cellnum++);
if (obj instanceof String) cell.setCellValue((String) obj);
else if (obj instanceof Integer) cell.setCellValue((Integer) obj);
}
}
try {
//Write the workbook in file system
System.out.println("OutPutStats.xlsx writing..............................");
FileOutputStream out = new FileOutputStream(new File("FileLocation/o.xlxs"));
workbook.write(out);
out.close();
System.out.println("OutPutStats.xlsx written successfully on disk.");
} catch (Exception e) {
e.printStackTrace();
}
}
}
dove lo trovo? – user2942227
@ user2942227 è possibile scaricarlo da [qui] (http://www.java2s.com/Code/Jar/x/Downloadxmlbeans230jar.htm) – Jhanvi
Ora ha generato questo errore, Eccezione nel thread "main" java.lang.NoClassDefFoundError : org/dom4j/DocumentExceptionCaused di: java.lang.ClassNotFoundException: org.dom4j.DocumentException, sai perché? – user2942227