Reputation: 62652
I am trying to figure out the difference between Add Variable and the Add Library buttons in Eclipse. So exactly when should add library be used instead of add variable? any explanation of best practices would be great.
Upvotes: 2
Views: 2396
Reputation: 29139
A variable-based build path entry is a reference to a single jar via an Eclipse equivalent of an environment variable. You control these variables in workspace preferences.
A library-based build path entry is a more flexible system where your build path refers to a symbolic entry that is resolved dynamically. Each entry can resolve to any number of jars. There are many types of libraries and new types can be added by plugins. For instance, in a basic Eclipse install you will see "JRE System Library". That one adds standard java classes from rt.jar and others. The most commonly used library is the "User Library". This allows you to name collections of jars in the workspace and then refer to these jars on the build path as a unit.
Upvotes: 1
Reputation: 44821
Add variable is useful when you don't keep your dependent jars under the same source control as your source code, and is also useful when you also have say an ant or maven build system outside eclipse.
Upvotes: 1