title: How to reference Eclipse jar variable from ant build.xml?
body: <p>I have an ant build script for a project which depends on an external jar. The location of the external jar is available in Eclipse as a variable (say, <code>JJ2000_LIB</code>, added through "Add variable" in project properties > Java Build Path > Libraries).
  <img src="https://i.stack.imgur.com/LINyN.png" alt="I&#39;m talking about variables like those">
  How do I access such Eclipse library variables from ant?</p>
  
  <p>Ideally I would like to be able to also run the same ant script from the command line and be able to set this variable.</p>
  
  <p>I've tried <code>env.JJ2000_LIB</code> which works from the command line (if I set a environment variable), but not from within Eclipse. My <code>build.xml</code> contains:</p>
  
  <pre><code>&lt;property environment="env" /&gt;
  &lt;property name="jj2000_lib" value="${env.JJ2000_LIB}" /&gt;
  
  &lt;target&gt;
      &lt;javac srcdir="${src}" classpath="${jj2000_lib}" destdir="${build}" /&gt;
  &lt;/target&gt;
  </code></pre>