Reputation: 2187
After reviewing the ant docs it is not clear as to what the differences are between the <path>
and <classpath>
tasks.
Are there any functional differences? Are they essentially interchangeable?
Any input would be appreciated, Thanks.
Upvotes: 10
Views: 1874
Reputation: 1
Difference between path and classpath in Java
path is set for use java tool in your java program like java, javac, javap. javac are used for compile the code. and classpath are used for use predefined class in your program for example use scanner class in your program for this you need to set classpath.
http://www.tutorial4us.com/java/difference-between-path-and-classpath
Upvotes: 0
Reputation: 78185
There isn't an Ant classpath
task. The classpath
XML element is a nested element that can be used in a number of other tasks (javac
for example) but it can't be used stand-alone in an Ant buildfile.
A classpath is just one particular use of a path. If you want to define a path to be used as a classpath in more than one place, you'd use the path
task to define it and include an id
parameter. Later, when declaring the classpath, you can refer to the earlier defined path by reference.
Something like:
<path id="my.classpath" ... />
Later:
<javac classpathref="my.classpath" ... />
Or:
<javac ... >
<classpath refid="my.classpath" />
...
</javac>
Upvotes: 16