Search code examples
javaexcelmavenimagejhssfworkbook

Exporting data to Excel works in eclipse but not when packaged as a .jar file


I have some code for an ImageJ plugin to export data to an excel document. The code works perfectly when I run it from Eclipse but when I export the code as a .jar or .zip file and run it I get an error.

"Error Exporting: org/apache/poi/ss/usermodel/workbook"

I'm not sure what this means or how to fix it. From what I can tell the necessary libraries are being included in the .jar file and as I said it works fine when running from Eclipse.

If anyone has any ideas or suggestions I'd be very grateful I've been trying to troubleshoot this or about a week now.

I've tried exporting as both .jar and .zip formats.

Honestly not sure what code would be relevant to show, as I said it works in Eclipse.

If anyone has advice here I'd be happy to show what I have.

The expected result is to create an excel workbook with the exported data in it.

What actually happens is the process errors out when being run outside of Eclipse with the error message above.


Solution

  • After a lot of digging around and talking with some coworkers, all I needed to do was add the needed .jar files directly into imageJ's plugin folder.

    This doesn't make any sense to me but it does fix the problem.