File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Ant, Maven and Other Build Tools and the fly likes Difference between fileset and pathelement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Difference between fileset and pathelement" Watch "Difference between fileset and pathelement" New topic

Difference between fileset and pathelement

Kanapathipillai Senthuran

Joined: Dec 20, 2012
Posts: 1

Can anybody please explain the difference between pathelement and fileset in ant script?

I saw some ant script examples where they use both pathelement and fileset to include the jars and class files in class path.

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

<pathelement path="${tomcat.lib}/servlet-api.jar" />
<pathelement path="${build}" />

Note: All the class files are located in build folder.

Thanks & Regards,
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 31400

A fileset lets you search/accumulate things into one reference. A path element is one "thing." That think may be one file or a whole path. But it doesn't do wildcards like fileset does.

This is explained fairly well in path like structures.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
It is sorta covered in the JavaRanch Style Guide.
subject: Difference between fileset and pathelement