Reputation: 3843
In eclipse, I am trying to add some libraries. I choose "build path->configure build path->libraries". The right column of the "java build path" window gives me several options: Add JARS, Add External JARS, and Add Library.
It seems to me that I should choose "Add Library", but what do the other two work for, "Add JARS" and "Add External JARS". What are the differences among these three options?
Upvotes: 2
Views: 2500
Reputation: 5648
Add Jars is for internal Jars - i.e. jars from your project workspace. Add external Jars is for jars in a different directory on your hard drive - e.g. ones you downloaded or from a diff workspace. This is the same as "Add Library" really, except that a library is a handy label for external jars that you add regularly. See http://www.javaprogrammingforums.com/java-code-snippets-tutorials/6536-javatip-dec-18-2010-eclipse-user-libraries.html for an example of how to add.
Upvotes: 3
Reputation: 76709
'Add JARS' allows you to add JARs that are resident in the workspace to the project build path.
'Add External JARS', well, allows you to add JARs that are resident outside the workspace. You can add JARs that are inside the workspace, but the above option is meant to perform that.
Libraries, on the other hand, refer to the various predefined libraries in Eclipse. A library is usually an organized collection of JARs. It could refer to:
Adding a Library adds all the entries specified in the library definition to the build path.
Upvotes: 1
Reputation: 49341
Have a look at this eclipse documentation - especially the Libraries tab section.
Upvotes: 0
Reputation: 6289
Add Library allows you to add a library defined in your Eclipse coniguration. If you check a project into a source control system and somebody checks it out, it would compile only if that developer has corresponding Eclipse libraries configured.
Add JARs allows to add jar files that are located in a subdirectory of your project's directory, usually named lib. You would check these jars into your source control system with your project and everyone who checks the project out would have these libraries.
Add External JARs is the least useful approach. It adds dependencies to the jar files of libraries located elsewhere on your computer and it hardcodes the pathnames of these files. If you check the project into a source control system and somebody checks it out, it would build only if they have the same libraries in the exact same places. Forget about teams using a mix of Windows, Mac and Linux workstations!
Upvotes: 1
Reputation: 633
Add Jars Lets you point to jars contained within your project.
Add External Jars Lets you point to jars anywhere on the file system.
Add Library Lets you point to a set of jars you have pre defined.
Upvotes: 0