I downloaded the latest release of Eclipse (Mars) and changed the required Java version to 1.6 in eclipse.ini file as my project uses Java 1.6.
I configured installe
I recently ran into this issue with Java 8 being on my machine, using Elicpse Oxygen and trying to use Ant to build a Java 6 project. I used some suggestions above but also encountered some strange behavior during the Ant build process. In the end it worked, here were my steps:
1) Java home ended up staying pointed to Java 8.
2) Set in the Ant script the values suggested by @Chris.
3) Do not change the Ant Runtime JRE, mine was left at 8, and in fact would not run the Ant build if I changed it to 6...
4) Project settings build path and compiler levels were all set to 6.
5) Run the build.
This produces a build at the Java 6 level that worked for me.