ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Moore, Kent" <Kent.Mo...@fisglobal.com>
Subject RE: How to check if available java version is higher equal than a required java version?
Date Tue, 27 Jul 2010 13:30:10 GMT
Another option is to add a routine like this to the init target - 

    <!-- check for java version and fail build if not the correct version -->
    <echo message="Java Version: ${java.version}"/>
    <echo message="Java home: ${java.home}"/>
    <fail message="Unsupported Java version: ${java.version}. Make sure that the version
of the Java compiler is 1.5 (5.0) or greater.">
        <condition>
            <not>
                <or>
                    <contains string="${java.version}" substring="1.5" casesensitive="false"
/>
                    <contains string="${java.version}" substring="1.6" casesensitive="false"
/>
                </or>
            </not>
        </condition>
    </fail>

-----Original Message-----
From: Jan.Materne@rzf.fin-nrw.de [mailto:Jan.Materne@rzf.fin-nrw.de] 
Sent: Tuesday, July 27, 2010 9:11 AM
To: user@ant.apache.org
Subject: AW: How to check if available java version is higher equal than a required java version?

Check for Classes which are new in that specific JDK.
    <available property="jdk1.5+" classname="java.net.Proxy"/>
    <available property="jdk1.6+" classname="java.util.ServiceLoader"/>
    <fail message="Require JDK 1.5 or higher" unless="jdk1.5+"/>

Jan 

>-----Urspr√ľngliche Nachricht-----
>Von: Ben Stover [mailto:bxstover@yahoo.co.uk] 
>Gesendet: Dienstag, 27. Juli 2010 14:35
>An: Ant Users
>Betreff: How to check if available java version is higher 
>equal than a required java version?
>
>Assume I have a build.xml which contains some java tasks 
>(javac, jar,...)
>
>I would like to make sure that the Java installation which is 
>used to compile the source code is higher equal
>than e.g. JAVA SE 1.5.03.
>
>How can I specify this version requirement (and an appropriate 
>error message) in a build.xml script?
>
>Ben
>
>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org

_____________

The information contained in this message is proprietary and/or confidential. If you are not
the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose,
distribute or use the message in any manner; and (iii) notify the sender immediately. In addition,
please be aware that any message addressed to our domain is subject to archiving and review
by persons other than the intended recipient. Thank you.
_____________

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message