为了账号安全,请及时绑定邮箱和手机立即绑定

为何Excel高版本会报NoClassDef?各种包也都引入了?

http://img1.sycdn.imooc.com//591c76ed0001a07707490151.jpg

http://img1.sycdn.imooc.com//591c76ee0001170603750370.jpg

String[] title = {"id", "name", "gender"};

第21行: XSSFWorkbook workbook = new XSSFWorkbook();

Sheet sheet = workbook.createSheet();

Row row = sheet.createRow(0);

Cell cell = null;

for (int i=0; i< title.length; i++){

cell = row.createCell(i);

cell.setCellValue(title[i]);

}

//Insert 10 records 

for (int i=1; i<10; i++){

Row nextrow = sheet.createRow(i);

cell=nextrow.createCell(0);

cell.setCellValue("a"+ i);

cell=nextrow.createCell(1);

cell.setCellValue("AI#" + i);

cell=nextrow.createCell(2);

cell.setCellValue("Male");

}

//Write the records into xls file

File file = new File("C:/eclipse/test_new.xlsx");

try {

file.createNewFile();

FileOutputStream stream = FileUtils.openOutputStream(file);

workbook.write(stream);

stream.close();

workbook.close();

System.out.println("Export Sucessfully!");

} catch (IOException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}


正在回答

1 回答

就是有jar包没有找到,找找看是不是有遗漏了


0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

为何Excel高版本会报NoClassDef?各种包也都引入了?

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信