Not sure you can rely on this if you are forking to another JVM in your <java> task.
Could you parse the output of java -version in this case ?



-----Original Message-----
From: Ilja Preuß [mailto:preuss@;disy.net]
Sent: 08 November 2002 14:00
To: Ant Users List
Subject: Re: Checking the java version


Looks OK to me.

I am using ${java.specification.version} instead of ${ant.java.version} - I
don't know wether this makes a difference, though.

Regards, Ilja



----- Original Message -----
From: "Xavier Loiseau" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, November 08, 2002 2:41 PM
Subject: Checking the java version


> Hi,
>
>
> What is the simplest way of checking the java version
> before running an application ?
>
> What is the simplest way of checking the java version
> before compiling an application ?
>
> This is an important issue since several java versions
> are often installed in a same computer.
>
> I have tried to solve both problems through the ant
> file that you will find below.
>
> But I am still wondering if it is the right way of
> solving those problems.
>
> Could anybody confirm that to me ?
>
> Kind regards.
>
>
> Xav
>
>
>
>
> <project name="sample" default="build" basedir="../">
>
>   <target name="run" depends="checkjavaversion">
>     <java classname="MyClass"
>           fork="yes"
>           classpath="MyClassPath" />
>   </target>
>
>   <target name="compile" depends="checkjavaversion">
>     <javac classpath="MyClassPath"
>            srcdir="MySourceDir"
>            destdir="MyDestDir"
>            includes="**/*.java" />
>   </target>
>
>   <target name="checkjavaversion" >
>
>     <condition property="isJavaVersionCorrect">
>         <equals arg1="${ant.java.version}"
>                 arg2="1.3" />
>     </condition>
>
>     <fail unless="isJavaVersionCorrect"
>           message="The java version should be 1.3 !"
> />
>
>   </target>
>
> </project>
>
>
>
> ___________________________________________________________
> Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
> Yahoo! Mail : http://fr.mail.yahoo.com
>
> --
> To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@;jakarta.apache.org>
> For additional commands, e-mail: <mailto:ant-user-help@;jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@;jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@;jakarta.apache.org>

Reply via email to