0

I have some old Java source code that raises an error in ant.

[javac]             Enumeration enum = props.propertyNames();
[javac]                         ^
[javac]   (use -source 1.4 or lower to use 'enum' as an identifier)

How can I teach ANT to use -source 1.4?

prosseek
  • 182,215
  • 215
  • 566
  • 871
  • OR, you could rename that local var to something different from enum, e.g. propEnum. You are getting this warning just because you are using what is essentially a reserved keyword in java 1.5+, with a javac 1.5+. – Patrice M. Nov 27 '12 at 06:42

1 Answers1

3

The Javac task has source and target properties to specify JVM version...

http://ant.apache.org/manual/Tasks/javac.html

as in something like the following in your build.xml...

<javac source="1.4" target="1.4" ...>
Zutty
  • 5,357
  • 26
  • 31
  • +1, Answered here as well if you need an example: http://stackoverflow.com/questions/1487978/setting-the-target-version-of-java-in-ant-javac – Anurag Kapur Nov 26 '12 at 15:34