I just started learning Apache POI I want to make a super simple spread sheet something like this in excel,
+----------+----------+----------+----------+----------+
| 1 | 2 | 3 | 4 | 5 |
+----------+----------+----------+----------+----------+
the code I wrote is as follows,
public void exportTable() throws IOException
{
FileOutputStream fos=new FileOutputStream(new File("C:\\Users\\*****\\OneDrive\\Desktop\\excel.xlsx"));
XSSFWorkbook wb=new XSSFWorkbook();
XSSFSheet ws=wb.createSheet();
XSSFRow row=ws.createRow(0);
for(int i=0;i<=5;i++)
{
Cell cell=row.createCell(i);
cell.setCellValue(i);
}
wb.write(fos);
fos.close();
}
I get a NoClassDefFoundError
I am using the following jar files.
1)poi-4.1.0.jar
2)poi-examples-4.1.0.jar
3)poi-excelant-4.1.0.jar
4)poi-ooxml-4.1.0.jar
5)poi-ooxml-schemas-4.1.0.jar
6)poi-scratchpad-4.1.0.jar
7)xmlbeans-3.1.0.jar
8)curvesapi-1.06.jar
And I am using jdk 1.8 on netbeans
P.S. I have near zero experience with Apache POI so I would be gratefull if you would write a detailed answer.Thanks
P.P.S. I don't know Maven
Edit: So i changed a few things
1)I imported all the jar files from "common-collections".
2)I changed ".xls" to ".xlsx"
3)I also Imported "common-compress" and now it works perfectly fine. Thanks!