tags:

views:

1380

answers:

2

I need to compile a jar file using ant (1.7.0) to run under a specific version of Java (1.5). I currently have Java 1.6 on my machine. I have tried setting:

<target name="compile">
  <javac compiler="javac1.5" target="1.5" srcdir=.../>
</target>

I have also removed

<property name="build.compiler" value="modern"/>

and there is no properties file. I am running Java 1.6 on Linux/SUSE

Also is there a simple way of determining which version of Java is expected in the jar file.

+6  A: 

Use "target" attribute and remove the 'compiler' attribute. See here. So it should go something like this:

<target name="compile">
  <javac target="1.5" srcdir=.../>
</target>

Hope this helps

NawaMan
This works, thanks
peter.murray.rust
+1  A: 

To find the version of the java in the classfiles I used:

javap -verbose <classname>

which announces the version at the start as

minor version: 0
major version: 49

which corresponds to Java 1.5

peter.murray.rust