I have written a java program to convert input xml file into some other xml file. While doing this I am using excel file and for accessing xml file I used apache-poi libraries.
When I run my program in eclipse it works fine and gives required results. Now I export the project in jar file and I selected my main class while exporting into jar. But when I run the jar file, I am getting following exception:
D:\>java -jar EDR_to_DER_with_excel.jar
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/Workbook
Caused by: java.lang.ClassNotFoundException: org.apache.poi.ss.usermodel.Workbook
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: com.unisys.xml.TestExcel. Program will exit.
The error is related to libraries that I am using. But I don't know why it's coming, because I am able to run the program in eclipse. Is the library class available in jar file> If not how can I give it to the jar while exporting?