ant-user mailing list archives

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

-----Original Message-----
From: Xavier Loiseau []
Sent: Friday, November 08, 2002 7:11 PM
Subject: Checking the java version


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.


<project name="sample" default="build" basedir="../">

  <target name="run" depends="checkjavaversion">
    <java classname="MyClass"
          classpath="MyClassPath" />

  <target name="compile" depends="checkjavaversion">
    <javac classpath="MyClassPath"
           includes="**/*.java" />
  <target name="checkjavaversion" >

    <condition property="isJavaVersionCorrect">
        <equals arg1="${}"
                arg2="1.3" />

    <fail unless="isJavaVersionCorrect" 
          message="The java version should be 1.3 !"



Do You Yahoo!? -- Une adresse gratuite et en fran├žais !
Yahoo! Mail :

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message