代码如下:
import java.io.FileOutputStream;
import java.io.IOException;
//import org.apache.poi.hssf.*;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.ss.usermodel.*;
public class ex1 {
public static void main(String[] args) throws IOException {
// 创建一个excel文件
Workbook wb = new HSSFWorkbook();
FileOutputStream fileOut = new FileOutputStream("C://workbook.xlsx");
wb.write(fileOut);
fileOut.close();
}
}
运行环境是Myeclipse,始终报错:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
HSSFWorkbook cannot be resolved to a type
HSSFWorkbook cannot be resolved to a type
at ex1.main(ex1.java:10)
是我的外部jar包添加有问题吗,还忘前辈们指导,谢谢。
慕虎7371278
饮歌长啸
慕娘9325324
繁星coding
相关分类