Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9038871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T09:35:40+00:00 2026-06-16T09:35:40+00:00

I am developing an Eclipse Java project and would like to use variables to

  • 0

I am developing an Eclipse Java project and would like to use “variables” to point to required libraries (.jar files).

Setup:

  • Machine 1: Eclipse Juno, OS X, own laptop, libs under /mylibs
  • Machine 2: Eclipse Juno, Linux, shared machine, libs under /sharedlibs/some/complex/path

Source control: Mercurial

Example of libs I use:

  • “${libs_base}/junit.jar”
  • “${libs_base}/guava.jar”
  • “${libs_base}/logging/slf4j.jar”

How can I configure the project Build Path to use the same “variable” for the base directory for libraries, pointing to different locations on different machines, but still check in my project description to source control so that when I add a new library, provided I specify its location relative to the libs base, it is found on both machines?

I have found the help file but could use an example, maybe even a screenshot please?

http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Fconcepts%2Fcpathvars.htm

for instance, do I copy this model:

http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Fconcepts%2Fconcepts-exttools.htm

inside “Java > Build Path > Classpath Variables” or elsewhere?

I have done a fair bit of “blind trial and error” already.. like stitching forms like “${env:VAR}” in there..

Oh, and I suppose I should mention that I don’t know how to set these Eclipse variables based on environment variables considering that my systems’ environment variables are set by Bash’s .profile and I doubt Eclipse runs a shell to source that before…

/org.eclipse.jdt.core/org.eclipse.jdt.core.classpathVariable.my_libraries=$MY_SYS_ENV_VAR_LIBS

Of course, I use “Configure Build Path > Libraries > Add Variable” and then Extend from there, but still… an example would be worth a 1000 words.. (could it be that defining an Eclipse variable from which to Extend actual .jar references for inclusion in Build Paths just can’t be based on a system environment variable, full stop?!)

PS: please don’t ask me to just symlink things around, I am not a sysadmin on the shared machine..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T09:35:41+00:00Added an answer on June 16, 2026 at 9:35 am

    From what I understand, extending a path variable would work perfectly for your case as you can define different base paths for each machine and reference libraries on subpaths based on that path. However if you are looking specifically to use environment variables you can try adding them to the build path this way:

    1. Edit your launch configuration.
    2. Go to the Classpath tab.
    3. Click on User Entries and click the Advanced button.
    4. To add a library based on a system environment variable, select Add
      Variable String
      , and in the box type:
      ${env_var:libs_base}/logging/slf4j.jar. In this case
      libs_base is your environment variable and logging/slf4j.jar is
      the path to the jar in the subdirectory.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing a Java EE project in Eclipse, and deploying it on Apache
I am developing an Eclipse Plugin for working with Java source files. When the
Possible Duplicate: Developing for Android in Eclipse: R.java not generating I cleaned my project
While Developing a Java EE Web app, I would like to know simple ways
I am developing a java project in eclipse. In order to distribute the program
I am currently developing an android project using eclipse JAVA and I had just
I'm developing a Java application using Eclipse. My project has two source directories that
I am developing a Java maven project with Eclipse and want to export a
I'm using Eclipse and developing a java application where I use of a local
For you all information i am developing one java project using Eclipse to interact

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.