title: ANT property environment="env" unable to retrieve it in JAVA but works fine if run as ant command
body: <p>I've a build file which will be called from java. Please find the build.xml below.</p>
  
  <pre><code>&lt;property environment="env"/&gt;
    &lt;echo message="${env.PATH}"/&gt;
    &lt;echo message="${env.SSH_CONNECTION}"/&gt;
    &lt;echo message="${env.JAVA_HOME}"/&gt;
    &lt;echo message="${env.HOME}"/&gt;
    &lt;echo message="${env.IS_HOME}"/&gt;
    &lt;echo message="${basedir}"/&gt;
  </code></pre>
  
  <p>Unable to fetch the environment variables if its run through java class. But the same works fine if run as ant command like "ant". Please help</p>
  
  <p>iF run as JAVA then error is</p>
  
  <pre><code>--- MESSAGE LOGGED
  Property ${env.JAVA_HOME} has not been set
  --- MESSAGE LOGGED
       [echo] ${env.JAVA_HOME}
  </code></pre>
  
  <p>But i could see that the environment variables are set fine. If i echo the variables command line , im able to see the value.</p>