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

后端 未结 9 2060
夕颜
夕颜 2020-12-28 15:42

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

9条回答
  •  生来不讨喜
    2020-12-28 16:19

    I'm uing Helios (i.e. 3.6.x) 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.

提交回复
热议问题