title: Eclipse Java project build path using variables
body: <p>I am developing an Eclipse Java project and would like to use "variables" to point to required libraries (.jar files).</p>
  
  <p>Setup:</p>
  
  <ul>
  <li>Machine 1: Eclipse Juno, OS X, own laptop, libs under <code>/mylibs</code></li>
  <li>Machine 2: Eclipse Juno, Linux, shared machine, libs under <code>/sharedlibs/some/complex/path</code></li>
  </ul>
  
  <p>Source control: Mercurial</p>
  
  <p>Example of libs I use:</p>
  
  <ul>
  <li>"${libs_base}/junit.jar"</li>
  <li>"${libs_base}/guava.jar"</li>
  <li>"${libs_base}/logging/slf4j.jar"</li>
  </ul>
  
  <p>How can I configure the project <code>Build Path</code> to use the same "variable" for the <strong>base</strong> 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 <strong>base</strong>, it is found on both machines?</p>
  
  <p>I have found the help file but could use an example, maybe even a screenshot please?</p>
  
  <p><a href="http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Fconcepts%2Fcpathvars.htm">http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Fconcepts%2Fcpathvars.htm</a></p>
  
  <p>for instance, do I copy this model:</p>
  
  <p><a href="http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Fconcepts%2Fconcepts-exttools.htm">http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Fconcepts%2Fconcepts-exttools.htm</a></p>
  
  <p>inside "Java > Build Path > Classpath Variables" or elsewhere?</p>
  
  <p>I have done a fair bit of "blind trial and error" already.. like stitching forms like "${env:VAR}" in there..</p>
  
  <p>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 <code>.profile</code> and I doubt Eclipse runs a shell to source that before...</p>
  
  <pre><code>/org.eclipse.jdt.core/org.eclipse.jdt.core.classpathVariable.my_libraries=$MY_SYS_ENV_VAR_LIBS
  </code></pre>
  
  <p>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 <code>Extend</code> actual .jar references for inclusion in Build Paths just can't be based on a <em>system</em> environment variable, full stop?!)</p>
  
  <p>PS: please don't ask me to just symlink things around, I am not a sysadmin on the shared machine..</p>