ant中如何引用系统环境变量
如题所示,想在build.xml中引用系统的环境变量,在网上搜索得到如下的实现:build.xml
<project name= "structured " default= "welcome ">
<property environment= "myPrefix "/>
<target name= "welcome ">
<echo message= "JAVA_HOME is set to = ${myPrefix.JAVA_HOME} "/>
</target>
</project>
运行的结果如下所示:
C:\> ant -buildfile build.xml
Buildfile: build.xml
BUILD FAILED
C:\build.xml:2:
java.lang.NullPointerException Total time: 3 minutes 40 seconds
C:\>
小弟的系统是xp的,JAVA_HOME 环境变量已经设置,而且其他的build.xml文件也可以正常执行;请各位高手指点。。。。。。。。。。。
------解决方案--------------------welcome:
[echo] JAVA_HOME is set to = C:\jdk6
执行没问题