Java Mailing List Archive

http://www.ant-tasks.com/

Apache Ant Archive

» Ant Users List
» Ant Developers List
Detecting JDK Version using ANT

Detecting JDK Version using ANT

2005-06-15       - By Zarar Siddiqi
Reply:     1     2     3     4     5     6     7     8     9  

Thank you all.

${ant.java.version} and ${java.version} yield two different values.  1.5 and
1.5.0_01, respectively.

I'm assuming ${ant.java.version} is the version Ant is using in case there
are multiple JDK's installed on the system and ${java.version} queries the
JAVA_HOME variable.

Am I correct?

Thanks again.



----- Original Message -----
From: "Ivan Ivanov" <rambiusparkisanius@(protected)>
To: "Ant Users List" <user@(protected)>
Sent: Wednesday, June 15, 2005 4:06 PM
Subject: Re: Detecting JDK Version using ANT


> Hello,
>
> you can try with java.version property:
>
> <project>
>    <echo>$${java.version} is ${java.version}</echo>
>    <echo>$${java.runtime.version} is
> ${java.runtime.version}</echo>
>    <!-- Dumps all properties starting with "java" -->
>    <echoproperties prefix="java"/>
> </project>
>
> Regards
> Ivan
>
> --- Zarar Siddiqi <zarar.siddiqi@(protected)> wrote:
>
>> Hi,
>>
>> Is there a clean way to detect what version of Java
>> is being used when running a build file?
>>
>> Some possible solutions include:
>>
>> 1) parsing the JAVA_HOME variable to detect the
>> version number
>> 2) Checking the existence of a file which is
>> specific to a version
>>
>> Both methods are somewhat brittle.
>>
>> Is there a sureshot way of knowing whether ANT is
>> being invoked using Java 1.5 or not?
>>
>> Thanks in advance,
>> Zarar
>
>
>
>
> __________________________________
> Discover Yahoo!
> Get on-the-go sports scores, stock quotes, news and more. Check it out!
> http://discover.yahoo.com/mobile.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)


©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.