I am trying to export a runnable jar to Eclipse, but I need it to include some other files needed to run my program

In particular, I use JDBC libraries to work with databases in my Java program. When I do an "Export Runnable Jar" in Eclsipe, it includes the referenced libraries, but I never get optino to include my resource folder (containing the database) in the runnable jar file. If I try to export a regular jar file via Eclipse, I can add a folder with resources, but library links are not included. What am I supposed to do here? Thank you very much.

+4
source share
3 answers

Are your resource directories declared as source folders in Eclipse?

Right-click on the folder, select "Build Path" โ†’ "Use as Source Folder". Then repeat the export.

In the long run, you really should look at a building tool such as maven or ant, they are much more flexible, and they are less dependent on Eclipse, so changes to the configuration of your project in Eclipse will not affect the final build.

+1
source

Try using Ant or maven scripts for this. If you can import all the specified jar and files to the right place.
Personally, I liked the Ant script, as it was easier, and you will probably get a lot of results for the same if you are google.

+3
source

It has been a while since the last time I generated a JAR file with Eclipse, and on the same day I remember the Fat-Jar Eclipse Plug-in to be very useful.

+1
source

All Articles