The JDT uses Classpath variables. These are useful for specifying the location of jar files or folders that are needed either during
Build,
Run or
Configuration without making direct reference to the local file system. This makes them particularly useful in team development.
In order to create a new classpath variable select
Preferences from the
Window menu and type
Classpath in the
Filter box and select
Classpath Variable as indicated in the image below.
There are sever built-in classpath variables where most of them have a gray slash and the word deprecated associated with them. All of these are deprecated settings and user should use
JRE system library for these paths instead.
User can add new Classpath Variable by clicking the
New button a window get appeared, give the variable name and then navigate either a jar file or a folder using the provided buttons and save the changes by clicking
OK button as shown in the image below.
User can use Classpath Variables in either
Build settings or in
Launch Configuration settings. Adding them to the Build Settings allows the Java Builder to find outside the project.
Right click on Project -> Select
Properties as shown in the image below.
Now, a popup window appears, navigate to
Java Build Path -> Click on
Libraries Tab -> Click
Add Variable button as shown in the image below.
Now, a popup window appears providing the list of Variables, user can add a variable directly or can extend the Variable using
Extend button to select a sub folder or down to a specific jar file. As shown in the image below.