Explain how to set classpath in ANT

Explain how to set classpath in ANT.

The following is the code snippet to set the classpath in ant:
<path id=”build.classpath”>
     <fileset dir=”${build.lib}” includes=”**/*.jar/>
     <fileset dir=”${build.class”}/>
</path>

<target….>
     <javac….>
     <classpath field=”build.classpath”/>
     </javac>
</target>

<target….>
     <javac….>
     <classpath field=”build.classpath”/>
     </javac>
</target>

Explain how to set classpath in ANT.

1. PATH- and CLASSPATH-type references can be specified using both ":" and ";" as separator characters. Ant converts the separator to the correct character of the current operating system.
2. <classpath>
    <pathelement path="${classpath}"/>
    <pathelement location="lib/helper.jar"/>
    </classpath>
3. The location attribute specifies a single file or directory relative to the project's base directory (or an absolute filename)
4. The path attribute accepts colon- or semicolon-separated lists of locations. The path attribute is intended to be used with predefined paths - in any other case; multiple elements with location attributes should be preferred.
5. The <classpath> tag supports path and location attributes of its own:
    <classpath path="${classpath}"/>
How does ANT read properties? How to set my property system?
How does ANT read properties? - Properties in ant are set in an order. Once a property is set, later the same property can not overwrite the previous one......
Explain how to modify properties in ANT
Explain how to modify properties in ANT - We can not modify the properties in ant. The properties in ant are immutable in nature...
Explain how to use Runtime in ANT
Explain how to use Runtime in ANT - There is no need to use Runtime in ant. Because ant has Runtime counterpart by name ExecTask...
Post your comment