ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Xavier Loiseau <xlois...@yahoo.fr>
Subject Checking the java version
Date Fri, 08 Nov 2002 13:41:19 GMT
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