Do not do it with difficulty. Use Eclipse's own exporter. First, make sure that you have other projects referenced by the projects in the main project, "Build Path." Having done this, just right-click the main project, select Export, and then Java> Runnable JAR file. Select the launch configuration (which you used to test the main() class locally), and then you have 3 options for processing the library to package the JAR:

The first option simply repackages the classes of other projects inside the JAR. Everything is just thrown together.
The second option will copy other projects as a JAR inside the JAR. This usually does not work, but Eclipse also adds a special launcher that basically copies the embedded JAR files to memory, extracts them, adds the files to the class loader, and then calls main() with this class loader.
The third option is what you do not want for this particular case.
source share