Jenny Brown (skywind8) wrote,
Jenny Brown

Ant javac strange error, and solution

I'm quite sure this little quirk will come back to bite me later, so I'm recording my discovery for my own future reference. Perhaps when I hit this again 2 years from now, I'll find my own answer in the Google-cache (it's happened before!).

The symptom:
Ant javac task fails with "No directory specified in fileset." error. The line that crashes is the javac task, which has srcdir and destdir both specified. This makes it look like javac is giving an error despite it having everything it needs for parameters. Very baffling.

The real problem:
Actually, javac task is is using a classpathref with its contents defined elsewhere, and one of the (many) entries in that points to a nonexistent directory or file. While a string path would merely end up with a skip, inside ant, paths are objects, not strings, and must be resolvable and 'perfect' -- legitimate, accurate, etc.

The solution:
In Eclipse, hover over each item in that composited path, individually, and look to see whether they show actual paths or some kind of error. Fix each one that has an error. Trace each back to its original source if necessary, to verify exact spelling, paths, subdirectories, etc. Once all classpath errors are resolved, ant's javac task will operate normally.

This was a really baffling error until I figured out the classpath setting was at fault. Then it became easy. Phew.
Tags: geek/programming
  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your IP address will be recorded 

  • 1 comment