title: The taskdef ant task cannot be found
body: <p>All - </p>
  
  <p>I'm following the most simplest instructions on this page: </p>
  
  <p><a href="http://ant.apache.org/manual/develop.html" rel="noreferrer">http://ant.apache.org/manual/develop.html</a> </p>
  
  <p>However, when I try to execute the target "main" I get this error in netbeans: </p>
  
  <blockquote>
  <pre><code>taskdef class dec102012.MyAntTask cannot be found using the classloader AntClassLoader[]
  </code></pre>
  </blockquote>
  
  <p>But this error does not make sense because my new Java class that extends "Task" looks like this: </p>
  
  <pre><code>package dec102012;
  
  import org.apache.tools.ant.BuildException;
  
  public class MyAntTask extends org.apache.tools.ant.Task{
      private String msg;
  
      // The method executing the task
      public void execute() throws BuildException {
          System.out.println(msg);
      }
  
      // The setter for the "message" attribute
      public void setMessage(String msg) {
          this.msg = msg;
      }
  }
  </code></pre>
  
  <p>The relevant portion in my build.xml looks like: </p>
  
  <pre><code>&lt;taskdef name="mytask" classname="dec102012.MyAntTask" classpath="dec102012"/&gt;
  
  &lt;target name="main"&gt;
      &lt;mytask message="Hello World! MyVeryOwnTask works!"/&gt;
  &lt;/target&gt;
  </code></pre>