Image apache poi word ne s'affiche pas lors de l’exportation en jar

Fermé
samaS23 Messages postés 3 Date d'inscription mercredi 5 décembre 2018 Statut Membre Dernière intervention 6 décembre 2018 - 5 déc. 2018 à 11:44
J'utilise apache poi word dans un projet java (maven). Dans ce document, j'utilise une image dans l'en-tête:

String imgFile ="src\\main\\resources\\entete.png";
run.addPicture(newFileInputStream((imgFile)),XWPFDocument.PICTURE_TYPE_PNG, imgFile,Units.toEMU (40),Units.toEMU (40));


ils fonctionnent tous correctement, sauf que lorsque j'ai essayé d'exporter le projet en tant que fichier exécutable, j'ai rencontré le problème suivant:

entete.png (The specified file was not found) and the image is not displayed in the word document



Pour les autres images du projet, j'ai ajouté la fonction

private static Image load (String file){
try{
return ImageIO.read (Student_Manager.class.getResourceAsStream (file));}
catch(IOException e)
{
e.printStackTrace ();}returnnull;}


alors j'ai utilisé:

Label_img.setIcon (newImageIcon(load ("students.png")));

mais pour l'image située dans le word, ce n'est pas le cas, si vous pouvez m'aider svp