2
java -version
java version "1.6.0_18"
Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
Java HotSpot(TM) Client VM (build 16.0-b13, mixed mode)

in ant i need to compile with java 1.5. I try like this:

<javac destdir="${dest.dir}/${package.name}/${model.dir}/${output.dir}"
           classpathref="classpath"
           debug="${javac.debug}" nowarn="${javac.nowarn}" fork="true" verbose="${verbose}"
           deprecation="${javac.deprecation}" encoding="Cp1250" source="1.5"
           target="1.5" memoryinitialsize="1024m"
           memorymaximumsize="1024m">

but it looks like ant still compile with 1.6. Can i see which java ant use for compile? i get error of "Bad version number in .class file"

C. K. Young
  • 219,335
  • 46
  • 382
  • 435
senzacionale
  • 20,448
  • 67
  • 204
  • 316
  • Which class file do you get the error for. Any chance this file is compiled by that task or might it be already compiled by a previous run without the `target="1.5"`? Or might it even be a library class? – Thomas Apr 22 '11 at 08:41

1 Answers1

0

Can i see which java ant use for compile?

Try this:

<echo message="ant.java.version: ${ant.java.version}" />

Also read this thread for more help: Ant is using wrong java version

Community
  • 1
  • 1
Harry Joy
  • 58,650
  • 30
  • 162
  • 207