this is odd...Can you run the following command just to verify the actual version of java that will be used though when running ant:
Thank you Daniel.
Problem is solved. In the classpath Jdk1.4.2 \lib folder is appended. I removed lib folder from classpath and working fine.