I have this constructor, that mentioned to read an xls
file in order to be manipulated by JXCEL API.
Fill(String file, int sheet, int cols, int rows) {
vService = new VipServiceImpl();
java.net.URL url = this.getClass().getResource("vips.xls");
System.out.println(url); //This gave me null
File f;
try {
f = new File(url.toURI());
} catch (URISyntaxException e) {
f = new File(url.getPath());
}
excelHandler = new ExcelHandler(f, sheet, cols, rows);
}
I have to mention that i have put the file vips.xls
in the same directory as Fill
class file, but it gives me a null pointer exception on the line of new File(url.toURI());
UPDATE: I really do now the difference between the classpath and filesystem path:(