Indicate the init and max memory when compiling : Memory « Ant « Java






Indicate the init and max memory when compiling

<project name="MyProject" default="compile" basedir=".">
    <property name="sourcedir" value="${basedir}/src"/>
    <property name="targetdir" value="${basedir}/build"/>
    <property name="librarydir" value="${basedir}/lib"/>

    
    <path id="libraries">
        <fileset dir="${librarydir}">
            <include name="*.jar"/>
        </fileset>
    </path>

    <target name="clean">
        <delete dir="${targetdir}"/>
        <mkdir dir="${targetdir}"/>
    </target>

    <target name="compile" depends="copy-resources">
      <javac srcdir="${sourcedir}"
             destdir="${targetdir}"
             classpathref="libraries"
             debug="on"
             fork="true"
             memoryMaximumSize="1024m"
             memoryInitialSize="256m">

      </javac>       
    </target>
    <target name="copy-resources">
        <copy todir="${targetdir}">
            <fileset dir="${sourcedir}">
                <exclude name="**/*.java"/>
            </fileset>
        </copy>
    </target>

    <target name="run" depends="compile">
        <java classname="Main" classpathref="libraries">     
             <classpath path="${targetdir}"/>
             <jvmarg value="-Djava.library.path=./lib"/> 
        </java>
    </target>
</project>


           
       








Related examples in the same category