David Ruan
David Ruan

Reputation: 794

Ant 1.8.1 showing incorrect java version?

I'm running Ant 1.8.1 under Win 7. And my Java version is 1.7_17.

I add the following 2 lines in my build file for diagnosing.

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

And the result is

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

Any idea on what's going on?

Is it hardcoded in Ant 1.8.1 that the highest java version it can show is 1.6?

Upvotes: 8

Views: 4179

Answers (3)

schoenk
schoenk

Reputation: 914

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

Upvotes: 0

David Ruan
David Ruan

Reputation: 794

I found this from Ant website. It's hardcoded actually.

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 I update my Ant to 1.9.0, the issue is solved.

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

It's kind of funny. :)

Upvotes: 12

gareth_bowles
gareth_bowles

Reputation: 21140

It looks like you have JAVA_HOME set correctly, but do you have %JAVA_HOME%\bin included in your PATH environment variable ? It looks like you're currently picking up the java.exe from a Java 6 installation.

Upvotes: 0

Related Questions