public static void main(String []args)throws IOException
{
//FileInputStream file = new FileInputStream(new File("test.xlsx"));
FileInputStream fis = new FileInputStream(new File("test.xlsx"));
XSSFWorkbook workbook = new XSSFWorkbook (fis);
XSSFSheet sheet = workbook.getSheetAt(0);
//Create First Row
XSSFRow row1 = sheet.createRow(0);
XSSFCell r1c1 = row1.createCell(0);
r1c1.setCellValue("Emd Id");
fis.close();
try
{
FileOutputStream fos =new FileOutputStream(new File("test.xlsx"));
workbook.write(fos);
fos.close();
System.out.println("Done");
}
catch(FileNotFoundException e)
{
e.printStackTrace();
}
}
The error is:
Exception in thread "main" java.io.FileNotFoundException: test.xlsx (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at excel.CxssfWe1.main(CxssfWe1.java:25)