I have faced the same issue. And for me the problem comes when i set environment variables as normal user and running ant with root privileges (sudo ant build). For me the problem got resolved by setting the environment variables under root (switch to root and set it). Then i issued sudo ant build and got the build successful. Try it out :) :)