org.apache.tools.ant.taskdefs

## Class WhichResource

- java.lang.Object
- - org.apache.tools.ant.ProjectComponent
  - - org.apache.tools.ant.Task
    - - org.apache.tools.ant.taskdefs.WhichResource

All Implemented Interfaces:
  java.lang.Cloneable

    public class WhichResource
    extends Task

Find a class or resource on the supplied classpath, or the system classpath if none is supplied. The named property is set if the item can be found. For example

     <whichresource resource="/log4j.properties"
       property="log4j.url" >

Since:
  Ant 1.6

### Field Summary

### Fields inherited from class org.apache.tools.ant.Task

`target, taskName, taskType, wrapper`

### Fields inherited from class org.apache.tools.ant.ProjectComponent

`description, location, project`

### Constructor Summary

Constructors
Constructor and Description
`WhichResource()`

### Method Summary

Methods
`Path` `createClasspath()` Adds a path to the classpath.
`void` `execute()` execute it
`void` `setClass(java.lang.String classname)` name the class to look for
`void` `setClasspath(Path cp)` Set the classpath to be used for this compilation.
`void` `setClasspathRef(Reference r)` Set the classpath to use by reference.
`void` `setProperty(java.lang.String property)` the property to fill with the URL of the resource or class
`void` `setResource(java.lang.String resource)` name the resource to look for

### Methods inherited from class org.apache.tools.ant.Task

`bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType`

### Methods inherited from class org.apache.tools.ant.ProjectComponent

`clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject`

### Methods inherited from class java.lang.Object

`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### WhichResource

    public WhichResource()

### Method Detail

#### setClasspath

    public void setClasspath(Path cp)

Set the classpath to be used for this compilation.

Parameters:
  `cp` - the classpath to be used.

#### createClasspath

    public Path createClasspath()

Adds a path to the classpath.

Returns:
  a classpath to be configured.

#### setClasspathRef

    public void setClasspathRef(Reference r)

Set the classpath to use by reference.

Parameters:
  `r` - a reference to an existing classpath.
Since:
  Ant 1.7.1

#### execute

    public void execute()
                 throws BuildException

execute it

Overrides:
  `execute` in class `Task`
Throws:
  `BuildException` - on error

#### setResource

    public void setResource(java.lang.String resource)

name the resource to look for

Parameters:
  `resource` - the name of the resource to look for.

#### setClass

    public void setClass(java.lang.String classname)

name the class to look for

Parameters:
  `classname` - the name of the class to look for.

#### setProperty

    public void setProperty(java.lang.String property)

the property to fill with the URL of the resource or class

Parameters:
  `property` - the property to be set.