poi异常:java.lang.NoSuchMethodError:org.apache.poi.hssf.usermodel.HSSFRow.getCell
今天想测试一下3.7版的POI(之前一直用的3.0版,蛮长时间了~)
有如下一段代码:
?
public static HSSFCell getCellFromSheetByCell(HSSFSheet sheet, int row, int col) { HSSFRow r = getRowFromSheetByRow(sheet, row); return r.getCell(col, Row.CREATE_NULL_AS_BLANK);}
?
总是在调用getCell的时候报错:?
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.poi.hssf.usermodel.HSSFRow.getCell(ILorg/apache/poi/ss/usermodel/Row$MissingCellPolicy;)Lorg/apache/poi/hssf/usermodel/HSSFCell;
是没有定义getCell方法吗?奇怪?
改成别的方式也会报类似错误,如:?
?
public static HSSFCell getCellFromSheetByCell(HSSFSheet sheet, int row, int col) { HSSFRow r = getRowFromSheetByRow(sheet, row); return r.getCell(col);}
?
下意识的开始搜索getCell函数的使用方法,但是Google了半天还是没啥结果。。。?
后来好奇地调用了下面这个函数,一切才真相大白?
System.out.println(HSSFWorkbook.class.getProtectionDomain().getCodeSource().getLocation());