ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Elankath, Tarun (Cognizant)" <ETa...@blr.cognizant.com>
Subject RE: Checking the java version
Date Fri, 08 Nov 2002 14:10:45 GMT
Looks fine to me :-)


-----Original Message-----
From: Xavier Loiseau [mailto:xloiseau@yahoo.fr]
Sent: Friday, November 08, 2002 7:11 PM
To: ant-user@jakarta.apache.org
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>

Mime
View raw message