Reputation: 344
I have some code which basically reads and writes data to excel file using Apache POI. I am running the code in my run and debug mode and it runs fine without any issues, but once I create a jar using the following command
Build -> Build Artifacts -> Build or Build -> Build Artifacts -> ReBuild
And then I try to run the jar I get the following error.
Exception in thread "JavaFX Application Thread" java.lang.NoClassDefFoundError: org/apache/poi/xssf/usermodel/XSSFWorkbook
I tried the following:
Line where the code errors out:
XSSFWorkbook workBookObj = new XSSFWorkbook(fileIn);
Upvotes: 1
Views: 741
Reputation: 344
To resolve the issue recreate the "Build Artifact" following are the steps:
File-> Project Settings -> Artifacts -> select the existing artifact -> - (hit remove)
Delete "META-INF" folder and "MANIFEST.MF" file from src
File-> Project Settings -> Artifacts -> select the existing artifact -> + (hit remove)
Artifacts -> Add -> Jar -> From modules with dependencies as shown below
Select the class which has the main method and hit OK.
Go back to Build -> Build Artificats -> Select your new artifact and click on create artifact as shown below
Upvotes: 2