next up previous contents index
Next: JProbe Coverage Up: Jlink Previous: Parameters   Contents   Index

Examples

The following will merge the entries in mergefoo.jar and mergebar.jar into out.jar. mac.jar and pc.jar will be added as single entries to out.jar.
<jlink compress="false" outfile="out.jar">
   <mergefiles>
     <pathelement path="${build.dir}/mergefoo.jar"/>
     <pathelement path="${build.dir}/mergebar.jar"/>
   </mergefiles>
   <addfiles>
     <pathelement path="${build.dir}/mac.jar"/>
     <pathelement path="${build.dir}/pc.zip"/>
   </addfiles>
</jlink>
Non-deprecated alternative to the above:
<jar compress="false" destfile="out.jar">
  <zipgroupfileset dir="${build.dir}">
    <include name="mergefoo.jar"/>
    <include name="mergebar.jar"/>
  </zipgroupfileset>
  <fileset dir="${build.dir}">
    <include name="mac.jar"/>
    <include name="pc.jar"/>
  </fileset>
</jar>
Suppose the file foo.jar contains two entries: bar.class and barnone/myClass.zip. Suppose the path for file foo.jar is build/tempbuild/foo.jar. The following example will provide the entry tempbuild/foo.jar in the out.jar.
<jlink compress="false" outfile="out.jar">
   <mergefiles>
     <pathelement path="build/tempbuild"/>
   </mergefiles>
</jlink>
However, the next example would result in two top-level entries in out.jar, namely bar.class and barnone/myClass.zip
<jlink compress="false" outfile="out.jar">
   <mergefiles>
     <pathelement path="build/tempbuild/foo.jar"/>
   </mergefiles>
</jlink>



Andrew Marlow 2003-07-08