Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse jar export and lib folder

Tags:

java

eclipse

I've a java project that use some external jar library, when i export my project with eclipse (File-Export-Runnable Jar File), i select the option for "copy external libraries into a subfolder next to the main jar" and eclipse automatically create for me a folder named :

myjarname_lib

I want to export the library in a folder named only lib , is it possible ? I've tried to rename the folder in lib but don't work, because the executable jar don't recognize the library in that folder. How can i change the name of the external lib ?

like image 224
aleroot Avatar asked Jan 20 '23 07:01

aleroot


1 Answers

Here is a workaround: When you run the Export wizard, there is a checkbox to create an Ant buildfile. Choose a location for the buildfile inside your project somewhere, then finish the export. Open the buildfile that was created (you might need to hit "F5" to refresh the project). Then just replace all "myprojectname_lib" with "lib". From then on, use "Run As -> Ant Build" for your exports instead of the Eclipse built-in.

The drawbacks are that this buildfile is completely independent of your project and it seems to manage copying each dependency individually. If you change the dependencies of your project, you will have to manually update this file to get the correct exports.

like image 87
Mac Avatar answered Jan 30 '23 17:01

Mac