How can I add build path items to Eclipse 3.5 using relative paths?

basszero picture basszero · Sep 15, 2009 · Viewed 16.3k times · Source

Eclipse 3.5 added support for relative buildpath/classpath items, yet I cannot seem to find a graphical way to add relatively pathed items. The example in new and noteworthy (search the page for 'relative', about 40% of the way down) seems to indicate that I have to manually edit the .classpath file. Am I just missing something?

Edit 2015: Updated link as it had went away. To preserve the "new and noteworthy" indefinitely, here's a screenshot of the mentioned section.

enter image description here

Answer

Chris Thompson picture Chris Thompson · Sep 16, 2009

The actual way to do this is to import the library into your workspace so,

Right Click in Package Explorer -> Import -> File System -> Browse (to the directory containing your jars) -> check the boxes next to the jars you want -> Browse to the workspace folder you want to import to (probably your lib folder) -> Finish

Keep in mind this will copy the files into the lib folder so I've found that it helps keep things clean if you don't already have them in there. They will now show up in the package explorer under "lib." To add them to the classpath,

Right click on the project -> Build Path -> configure build path... -> Add JARs -> navigate to the given project's lib folder and select the appropriate JARs -> click ok -> click finish

This adds them to the CP with relative locations.

If you need more help let me know