When I try to add data to Excel from Java Ant, it shows NoClassDefFoundError
, even that I imported all Jar files of Apache Poi. This is the Error:
Exception in thread "main" java.lang.NoClassDefFoundError:org/apache/commons/io/output/UnsynchronizedByteArrayOutputStream
This is the code i tried:
XSSFWorkbook wb = new XSSFWorkbook();
XSSFSheet sheet = wb.createSheet("Sheet1");
XSSFRow row = sheet.createRow(0);
Cell cell0 = row.createCell(0);
cell0.setCellValue("HelloWorld!");
try{
FileOutputStream out = new FileOutputStream(new File("Result.xlsx"));
wb.write(out);
out.close();
System.out.println("Done");
}catch(FileNotFoundException e){
e.printStackTrace();
}catch(IOException e){
e.printStackTrace();
}
These are Jar imported files:
CodePudding user response:
Problem solved! It seems i needed to add dependecy to build.xml also after importing jar files!