I have a problem. I wrote a little program for a friend. I read a .xlsx-file and update this. In the IDE it works well. But if i build a .jar and execute it, then i get the error "Your InputStream was neither an OLE2 stream, nor an OOXML stream or you haven't provide the poi-ooxml*.jar in the classpath/modulepath".
There are abstracts of my code:
//Import Excel
public static ImportDaten importExcel() throws IOException {
ImportDaten importDaten = new ImportDaten();
java.util.List<Kunde> kunden = new ArrayList<>();
List<Artikel> artikelList = new ArrayList<>();
DataFormatter dataFormatter = new DataFormatter();
File inputWorkbook = new File("C:/Users/jboeh/OneDrive/Desktop/stammdaten.xlsx");
Workbook workbook = WorkbookFactory.create(inputWorkbook);
//Rechnungsnummer einlesen
Sheet indexSheet = workbook.getSheet("Index");
//read data
workbook.close();
importDaten.setKunden(kunden);
importDaten.setArtikelList(artikelList);
return importDaten;
}
public static void exportExcel() throws IOException {
FileInputStream inputStream = new FileInputStream(new File("C:/Users/jboeh/OneDrive/Desktop/stammdaten.xlsx"));
Workbook workbook = WorkbookFactory.create(inputStream);
Sheet sheetIndex = workbook.getSheet("Index");
Cell zelleRechNr = sheetIndex.getRow(0).createCell(1);
zelleRechNr.setCellValue(rechnung.getRechnungsnr());
Sheet sheetRechnung = workbook.getSheet("Rechnung");
Cell zelleRechnung;
//write Data
inputStream.close();
FileOutputStream outputStream = new FileOutputStream("C:/Users/jboeh/OneDrive/Desktop/stammdaten.xlsx");
workbook.write(outputStream);
workbook.close();
outputStream.close();
}
I hope somebody can help me.
Thanks
Mira