managing jar files with relative paths in eclipse 09-04-2014d1613

2015-02-06

managing jar files with relative paths in eclipse 09-04-2014d1613
include java library in project

Doing this allows you to quickly add the project to other computers without forcing you to import all of the necessary jar files each time.

answer here

I'm uing Helios and this is what I do to reference a lib (jar) outside of my project in a relative manner.

1) Right click project in project explorer -> Import -> Import. 2) Select File System (Next) Use the browse button to navigate to the folder (yes, it looks like a hard-path). Select the .jar(s) to include.

I usually append "\lib" to the project name in the "Into Folder:" option.

Click "Advanced" and select the "Create Links in workspace" and I use the default options (both checked, and relative to PROJECT_LOC). 3) Click Finish

Next, open up the project properties and go to Java Build Path Libraries tab and select "Add Jars..." and go to the \lib folder (from Step 2) and select the lib(s) that you need. On the Libraries tab now has "ProjectName/Lib" for the path of the lib(s).

The project explorer will display a lib folder with your libs with a special icon. If you look in your hard drive for the lib folder, there is nothing there. So it is referring to the libs in the external path, but including them as a "project" lib.

Right click on the jar file in the project explorer and do properties. You should see the relative path goodness.