Ant Build from Eclipse - File Not Found Error

You might be thinking that getting Ant errors of a file not found on Windows is due to spaces in file names.

Actually, Ant and Eclipse are probably handling spaces on Windows fine, it’s the backslashes on Windows directories that are causing the problems.

Because Eclipse and Ant are Sun Java based, backslashes are interpreted as string literals, so a \g, might mean g, while a \n means a newline.

To get around this problem, simply double backslash encode your string.  So, for C:\Program Files\My Application\Test 1, change it to C:\\Program Files\\My Application\\Test 1\\.

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • E-mail this story to a friend!
  • LinkedIn
  • Live
  • MySpace
  • Turn this article into a PDF!
  • Reddit
  • Technorati
  • Twitter
  • Yahoo! Bookmarks
  • Yahoo! Buzz

Leave a Reply

You must be logged in to post a comment.