Ant文件出错

时间:2014-03-19 07:31:44

标签: java ant

我的构建xml文件中有以下代码

 <"/fail unless="java.home1_6" message="Property java.home1_6 must be set to a JDK of version 1.6"/>
      <"/echo message="Java home used for building JavaUtilities:${java.home1_6}"/>
        <"/property name="javac.executable" location="${java.home1_6}/../bin/javac.exe"/>
      <"/available file="${javac.executable}" property="javac.found"/>
      <"/fail unless="javac.found" message="javac.exe was not found"/>

但是当我运行该文件时,它显示以下错误

BUILD FAILED
D:\Mand\javautilities\build.xml:4: Property java.home1_6 must be set to a JDK of version 1.6

1 个答案:

答案 0 :(得分:1)

请在您的计算机中设置JAVA_HOME环境变量。它失败了,因为没有设置属性JAVA_HOME。如果您不想在机器级别设置它,请在build.xml文件中设置它。

代码发布后

更新

看起来您在build.xml文件中使用了属性java.home1_6。您需要使用属性文件或using the property task在文件中设置它。

例如

<property name="foo.dist" value="dist"/>