简体   繁体   中英

How to set JAVA HOME in Ant build.xml

I have the following build.xml file and i want to set JAVA HOME path but i don't know where to write and what to write. Does anyone wants to help me?

<target name="clean">
    <delete dir="build"/>
</target>

<target name="compile">
    <mkdir dir="build/classes"/>
    <javac srcdir="src" destdir="build/classes"/>
</target>

<target name="jar">
    <mkdir dir="build/jar"/>
    <jar destfile="mapreduce.jar" basedir="build/classes">
        <manifest>
            <attribute name="Main-Class" value="Master"/>
        </manifest>
    </jar>
</target>

<target name="run">
    <java jar="mapreduce.jar" fork="true"/>
</target>

You can create a env.bat file (if your on windows)

inside you would include this:

SET JAVA_HOME=C:\java\jdk1.5

then you would do something like this:

env.bat

ant -f build.xml all

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM