I have the following Ant target to show the value of the JAVA_HOME
environment variable:
<target name="show-java-home">
<echo message="${env.JAVA_HOME}"/>
</target>
However, I get the following result:
show-java-home:
[echo] ${env.JAVA_HOME}
BUILD SUCCESSFUL
Total time: 292 milliseconds
What am I doing wrong?
Try this:
<property environment="env"/>
<target name="show-java-home">
<echo message="${env.JAVA_HOME}"/>
</target>
more info here: https://ant.apache.org/manual/Tasks/property.html
You're doing everything right.
This Ant console output tells you that %JAVA_HOME%
simply isn't defined:
show-java-home:
[echo] ${env.JAVA_HOME}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.