reading excel file + null pointer exc + inputstream is null
807605Aug 17 2007 — edited Aug 17 2007hi i m accessing the xls sheel in my class if i put it with code it works but when i saparate it and put it other folder and put whole path instead of its name it throws exception as
Exception in thread "main" java.lang.NullPointerException
at jxl.read.biff.File.<init>(File.java:77)
at jxl.Workbook.getWorkbook(Workbook.java:250)
at jxl.Workbook.getWorkbook(Workbook.java:235)
at org.drools.decisiontable.parser.xls.ExcelParser.parseFile(Unknown Source)
at org.drools.decisiontable.SpreadsheetCompiler.compile(Unknown Source)
at org.drools.decisiontable.SpreadsheetCompiler.compile(Unknown Source)
i m using drools framework and this uses jxl to read xls file
the code specific to this is
private InputStream getSpreadsheetStream() {
File file = new File("WEB-INF/drools/Tariff.xls");
return this.getClass().getResourceAsStream(file.getAbsolutePath());
}
and
String drl = compiler.compile(getSpreadsheetStream(), InputType.XLS);
System.out.println(drl);
after tring to solve i got the point that it could not create inputstream thats why it does not function properly ...
my my quiestion is still open that why it is unable to create an input stream if i put the xls file else where instead of in the same place where java file is....
plz reply