On 03/01/06, K.Srikumar <[EMAIL PROTECTED]> wrote: > > Hello everybody, > Sorry if i am asking silly questions, since i am only a starter. > ... > Now i am able to create jar files, but unable to do so in a desired > folder. > The corresponding code is as follows: > ++++++++++++++++++++++++++++++++++++++++++++ > <target name="createjar" description="Jars the class files"> > <mkdir dir="${jardir-name}"/> > <jar basedir="${jardir-name}" destfile="${jarfile-name}" > includes="**/*.class"/> > </target> > > <target name="usejar" description="Runs the class from the Jar file" > depends="createjar"> > <java classname="hello" classpath="${jarfile-name}" fork="true"/> > </target> > +++++++++++++++++++++++++++++++++++++++++++++ > > > and i also want to know why -----------fork="true"------------is used... > > Please reply immediately, > Thank u, > bye > > =============================================== > The complete build file is as follows, for reference: > =============================================== > <project name="compile" default="speak" basedir="."> > > > <property name="path" location="dest"/> > <property name="jardir-name" location="jar-files"/> > <property name="jarfile-name" value="hello.jar"/> > > > <target name="compile"> > <mkdir dir="${path}" /> > <javac srcdir="src" destdir="${path}" /> > </target> > <target name="speak" description="Prints the developer's Name"> > <echo message=" You did not specify any target "/> > <echo message=" "/> > <echo message=" K.Srikumar"/> > </target> > <target name="clean" description="Clear the new dirs"> > <delete dir="${path}"/> > </target> > <target name="doall" depends="compile,speak,clean" description="Run all > the targets"/> > <target name="-hidden"> > <echo message="This is hidden"/> > </target> > <target name="createjar" description="Jars the class files"> > <mkdir dir="${jardir-name}"/> > <jar basedir="${jardir-name}" destfile="${jarfile-name}" > includes="**/*.class"/> > </target> > <target name="usejar" description="Runs the class from the Jar file" > depends="createjar"> > <java classname="hello" classpath="${jarfile-name}" fork="true"/> > </target> > > </project> > > > > :)K . S R I K U M A R > > --------------------------------- > Yahoo! Photos > Ring in the New Year with Photo Calendars. Add photos, events, holidays, > whatever. >
You can place the absolute path to the folder where you want to create the jar file for example: <property name="${jarfile-name}" location="/home/srikumar/ant/temp/myFirstJar.jar"/> and then using the target you have supplied your jar file will be placed in it. For the second question fork="true" is used to invoke ant to trigger the class execution in another VM (disabled by default). But all that is written in the manual [1]. It is a good idea to search in it before posting here. Hope that helps! [1] http://ant.apache.org/manual/index.html -- Regards, Petar!