Configuring Java version for ANT in eclipse

ant, eclipse, java

Solution

You can do this in the `Run Configuration`. Right click your ant file ant select `Run as` -> `Ant Build...`. On the `JRE` tab you can switch to any JRE.

Maybe you have to add the concerning JRE to eclipse first by clicking `Installed JREs...` this opens the Eclipse preferences dialog where you can add it.

Problem

In IntelliJ if I want to configure the version of Java my ANT script uses I can just right click and set the properites for ANT and select the JDK I want to use. In Eclipse I don't see any such option. Do I need to hard code the version of Java into my Script or is there any way to tell ANT what version I want it to use?

Original source