title: Unable to import class in ant javascript
body: <p>I am writing an inline javascript in ant. This script will scan a directory and output the names of files that are not up to date with respect to a given timestamp.</p>
  
  <pre><code>&lt;script language="javascript"&gt; &lt;![CDATA[
  
    importPackage(Packages.java.lang);
    importPackage(Packages.org.apache.commons.io.FileUtils);
    importClass(Packages.java.io.File);
    importClass(Packages.java.util.Iterator);
  
  
    var path = "D:\DirectoryToScan\";
    var timeToCompare = buildServers.getProperty("buildStartTime");
  
    var invocationTime = new Date(timeToCompare );
    invocationTime = invocationTime.getTime();
  
    var directoryToSearch = new File(path );
    //CODE BREAKS HERE. NONE OF THE SUBSEQUENT LINES EXECUTE  
    var fileIterator = FileUtils.iterateFiles(directoryToSearch, new String[]{"pdf","html"} , true);
  
  
    //iterate through files and directories in builtDocs folder and return false if any of the files is older than invocation time
    while (fileIterator.hasNext()) {
       var doc = fileIterator.next();
       if ((!FileUtils.isFileNewer(doc, invocationTime))) {
          return false;
       }        
    }
  ]]&gt; &lt;/script&gt;
  </code></pre>
  
  <p>I have noticed that the first call to FileUtils breaks. I also tried using some simple classes but they were not accessible and looks like import statement is not working for custom classes or belong to packages that apparently are not accessible here (such as apache.tools.ant.util.FileUtils). </p>
  
  <p>Is there something that i need to do here to load the classes correctly before accessing them?</p>