I have Java 6 and 7 installed. How do I specify ant to use Java 6 to compile? I've seen some threads that set the java 6 compiler path, and that worked, but I also saw threads like this Setting the target version of Java in ant javac which set a simple attribute in the javac task. And then sometimes it says to specify the target and the source.
I read here http://docs.oracle.com/javase/7/docs/technotes/tools/solaris/javac.html#examples but still do not understand the use of the two attributes. From the oracle docs, it seems like source
specifies the language rules (e.g. "this uses java6 rules, so there won't be any try-with-resource blocks"), and target
specifies the java-version-bytecode to generate? The docs seem to imply the source
should always be set, but how come the question in the first link just says just to specify the target=1.6
attribute?