Thanks Robert.  

It was actually the case in my circumstance that we needed 
to make sure that j2ee 1.2 is used and not a *later* version.  
So, I wound up implementing a check for 
javax.servlet.ServletContextEvent, which was introduced in 1.3  

-- Dennis

-----Original Message-----
From: Robert Leftwich [mailto:[EMAIL PROTECTED]]
Sent: Sunday, May 20, 2001 7:23 PM
To: [EMAIL PROTECTED]
Subject: Re: How to check j2ee version?


At 09:09 AM 21-05-01, Dennis Gregorovic wrote:
>Our build system depends on version 1.2 of j2ee.jar
>being used.  How can I check the version of j2ee.jar
>from Ant?

I don't know if there is a class in v1.2 that is not in the previous 
versions but if there is you can use the available tag to set a property 
only if that class is available e.g.

<!-- set the j2ee version -->
<target name="set-j2ee-version">
   <available property="j2ee1.2+" classname="unique.1.2+.j2ee.class" />
</target>

<!-- make sure j2ee version is at least 1.2 -->
<target name="ensure-j2ee" depends="set-j2ee-version" unless="j2ee1.2+">
   <fail message="Can only build if running with J2EE 1.2+"/>
</target>

HTH

Robert


Reply via email to