JMRboosties
JMRboosties

Reputation: 15740

I'm trying to export a runnable jar in Eclipse, but I need it to include some other files necessary for running my program

Specifically, I am using JDBC libraries to work with databases in my Java program. When I perform "Export Runnable Jar" in Eclipse, it includes the referenced libraries but I am never given an option to include my assets folder (containing the databases) in the runnable jar file. If I try to export a regular jar file via Eclipse, I can add the assets folder, but the referenced libraries are not included.

What should I do here?

Thanks a lot.

Upvotes: 4

Views: 6394

Answers (3)

Matthew Farwell
Matthew Farwell

Reputation: 61705

Are your asset directories declared as Source Folders in Eclipse?

Right Click on the folder, choose Build Path->Use as Source Folder. Then retry the export.

In the longer term, you should really be looking at a build tool such as maven or ant, they are much more flexible, and they are less dependent on Eclipse, so changes in your project configuration in Eclipse won't affect the final build so much.

Upvotes: 1

Xavi López
Xavi López

Reputation: 27880

It's been some time since I last generated a JAR file with Eclipse, and back in the day I remember the Fat-Jar Eclipse Plug-in to be quite useful.

Upvotes: 1

Naveen Babu
Naveen Babu

Reputation: 1584

Try using Ant scripts or maven script to do this. Where you can import all the referenced jar and files to your desired location.
Personally i liked ant script, since it was easier and you will surely get lot of results for the same if you google.

Upvotes: 3

Related Questions