I am using Poi Apache to generate an excel file, I have to add a picture to my file but the problems is when I export my project to a Runnable Jar, it is not working.
InputStream is = ExcelTools.class.getClassLoader().getResourceAsStream( "./ensao/pfa/opendelib/resources/LogoOpen.jpg" );
byte[] bytes = IOUtils.toByteArray(is);
int pictureIdx = wb.addPicture(bytes, Workbook.PICTURE_TYPE_JPEG);
is.close();
Drawing drawing = sheet.createDrawingPatriarch();
HSSFClientAnchor anchor = new HSSFClientAnchor(40, 10, 65, 20,
(short) 0, 0, (short) 0, 0);
anchor.setAnchorType(1);
Picture pict = drawing.createPicture(anchor, pictureIdx);
pict.resize();
the problem is launched from this line :
byte[] bytes = IOUtils.toByteArray(is);