Ant 1.8.1 showing wrong java version?

I am running Ant 1.8.1 under Win 7. And my version of Java is 1.7_17.

I am adding the following 2 lines to my build file for diagnostics.

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

And the result

  [echo] java.version = 1.6 [echo] java.home = C:\Program Files\Java\jre7 

Any idea what is going on?

Is it hard-coded in Ant 1.8.1 that the highest version of java that it can show is 1.6?

+6
source share
3 answers

I found this on the Ant website. It is actually hardcoded.

 ant.java.version the JVM version Ant detected; currently it can hold the values "1.2", "1.3", "1.4", "1.5" and "1.6". 

After updating my Ant to 1.9.0, the problem is resolved.

  [echo] java.version = 1.7 [echo] java.home = C:\Program Files\Java\jdk1.7.0_17\jre 

This is ridiculous.:)

+10
source

It looks like you installed JAVA_HOME correctly, but do you have% JAVA_HOME% \ bin included in the PATH environment variable? It looks like you are currently building java.exe from a Java 6 installation.

0
source

I think ant.java.version shows the version of Java with which Ant was created. The actual version of your java installation is stored in java.version .

0
source

All Articles