In Eclipse, “build variable” can mean three different things: a CDT variable used by C/C++ build settings, a Java classpath variable that points to a dependency, or a platform path variable used for linked resources. Choose the system that matches the setting you are changing; they are not interchangeable.
Which Eclipse variable do you need?
| Variable system | Used by | What the variable represents | Scope and portability |
|---|---|---|---|
| CDT build variable | C/C++ builder settings | A value used in supported build commands, targets, or build-directory settings | Managed in CDT preferences and used in project build configurations; availability depends on the builder and configuration. |
| Java classpath variable | Java build path | The location of a JAR file or folder dependency | Provides indirection instead of embedding a machine-specific path in a build-path entry. |
| Platform path variable | Eclipse resource manager | A filesystem location used as a linked-resource target | Can be defined at project or workspace level; project-level mappings can help linked resources work across different workspaces or computers. |
Eclipse’s Path Variables documentation describes them as variables that “specify locations on the file system.” That is distinct from a CDT variable used by a builder or a Java variable used by a build-path entry.
| # | Preview | Product | Price | |
|---|---|---|---|---|
| 1 |
|
Eclipse IDE Pocket Guide: Using the Full-Featured IDE | $9.71 | Buy on Amazon |
| 2 |
|
Competitive Programming 4 - Book 1: The Lower Bound of Programming Contests in the 2020s | $20.79 | Buy on Amazon |
| 3 |
|
Eclipse | $25.91 | Buy on Amazon |
| 4 |
|
Eclipse Cookbook: Task-Oriented Solutions to Over 175 Common Problems | $21.93 | Buy on Amazon |
| 5 |
|
The C Programming Language | $42.74 | Buy on Amazon |
Add a local build variable for a CDT C/C++ project
- Open Window > Preferences > C/C++ > Build > Build Variables.
- Add a variable by entering its name, selecting its type, and entering its value, then save the preference.
- Open the project’s Properties > C/C++ Build settings and use the variable control in the relevant supported field, such as a build command, build target, or build-directory setting.
- Check the applicable builder and configuration if the variable is unavailable or does not expand as expected. The fields that support variables depend on those choices.
The CDT documentation covers both C/C++ Build project properties and adding and editing build variables. CDT also documents environment-variable expansion in makefiles; that behavior is separate from defining a local CDT build variable. Auto-build and manual-build behavior are also distinct, so check which build mode applies when a change does not appear to take effect.
Use a variable for a Java dependency
For a JAR or folder used by a Java project, configure a classpath variable rather than a CDT build variable or a linked-resource path variable.
Recommended Free Tools
#1 Best Overall
- To add it from a Java project, open Java Build Path > Libraries > Add Variable.
- Alternatively, manage variables under Java > Build Path > Classpath Variables in Eclipse preferences.
- Point the variable to the intended JAR or folder, then use it in the Java build-path entry.
The Classpath Variables guide explains the indirection. The Java Build Path reference describes entries visible to the compiler, including source, project, and library entries. In Java 9 and later projects, entries may be placed on either the classpath or modulepath.
Use a path variable for a linked resource
A linked resource points into the filesystem without placing the target inside the project directory. A path variable can make that target less dependent on one computer’s absolute directory layout.
- Define the path variable at the project or workspace scope appropriate for the resource.
- Create or edit the linked resource and select the variable when specifying its location.
- If you change a variable already used by linked resources, refresh the affected project so Eclipse can discover filesystem changes.
Project-level definitions can help a shared project resolve linked-resource targets in different workspaces or on different computers. The Linked resources developer guide describes variable mappings and broken links; the Linked Resources preference reference covers workspace settings. Eclipse documents the linked-resource workflow in Creating Linked Resources.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Fix common variable problems
- The variable is missing from a CDT field: Check whether that field supports variables for the selected builder and configuration; not every build field offers the same controls.
- A linked resource is broken: Verify that the variable is defined at the scope used by the link and that its target exists. A missing definition or nonexistent target can prevent Eclipse from resolving the resource.
- A linked resource does not reflect a changed location: Refresh the affected project after changing an in-use path variable.
- The linked-resource option is unavailable: Some plug-ins do not support linked resources, and the workspace can disable the feature.
- A Java library is not resolving: Confirm that you used a Java classpath variable for the JAR or folder and that the build-path entry points to the intended location.
Platform path-variable details are described in the Eclipse documentation on linked resources and the linked-resource creation procedure. Dynamic variables are a separate platform mechanism; the path variable resolver reference documents resolver-provided variables. Names listed in user and developer documentation can differ by context, so do not assume a variable is valid in every Eclipse preference page.
Free tools Windows power users keep installed
One-click scans. No signup required.
Quick Recap
Best Value
Rank #4
- Used Book in Good Condition
Rank #3
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

