//reading Excel
Public static void main (String [] args) {
The File File=new File (" D: \ \ test. XLSX ");
XSSFWorkbook XSSFWorkbook=null;
InputStream InputStream=null;
Try {
InputStream=new FileInputStream (file);
XssfWorkbook=new xssfWorkbook (inputStream);//an error line
Sheet Sheet=xssfWorkbook. GetSheetAt (0);
Int row_num=sheet. GetLastRowNum ();
For (int j=0; J & lt; Row_num; J++) {
The Row Row=sheet. GetRow (j);
Int num=row. GetRowNum ();
For (int I=0; I & lt; num; I++) {
The Cell Cell=row. GetCell (I);
System. The out. Println (cell. GetStringCellValue ());
}
}
} the catch (IOException e) {
e.printStackTrace();
} the finally {
Try {
If (xssfWorkbook!=null)
XssfWorkbook. Close ();
} the catch (IOException e) {
e.printStackTrace();
}
}
}
CodePudding user response:
Runtime environment without introducing relevant jars