简体   繁体   中英

Eclipse jar export and lib folder

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM