I have a similar problem but on the run time level. I have been working on a
task that should among other things upgrade the production
(deployment)JDK/JRE. 
To be able to do this I have to identify exactly what version of Java that
is installed.

With other words is there a more precise method for Java version
identification?

/Christian Holmqvist

> -----Ursprungligt meddelande-----
> Från: Stefan Bodewig [mailto:bodewig@;apache.org]
> Skickat: den 8 november 2002 15:11
> Till: [EMAIL PROTECTED]
> Ämne: Re: Checking the java version
> 
> 
> On Fri, 8 Nov 2002, Ilja Preu <[EMAIL PROTECTED]> wrote:
> 
> > I am using ${java.specification.version} instead of
> > ${ant.java.version} - I don't know wether this makes a difference,
> > though.
> 
> Yes, it does.
> 
> ${java.specification.version} is a system property JVM implementors
> can (must?) implement, but I'm not sure whether the rules are well
> defined here.  I wouldn't bet that Kaffee will set it correctly for
> example.
> 
> ${ant.java.version} is what Ant has detected.  Ant's detection code
> tries to load a certain set of classes that have been added in certain
> Java versions, the code is
> 
>         try {
>             javaVersion = JAVA_1_0;
>             javaVersionNumber=10;
>             Class.forName("java.lang.Void");
>             javaVersion = JAVA_1_1;
>             javaVersionNumber++;
>             Class.forName("java.lang.ThreadLocal");
>             javaVersion = JAVA_1_2;
>             javaVersionNumber++;
>             Class.forName("java.lang.StrictMath");
>             javaVersion = JAVA_1_3;
>             javaVersionNumber++;
>             Class.forName("java.lang.CharSequence");
>             javaVersion = JAVA_1_4;
>             javaVersionNumber++;
>         } catch (ClassNotFoundException ...
> 
> In a certain sense, this is more reliable than
> ${java.specification.version} as Ant detects what is there instead of
> what the VM claims to be.
> 
> On the other hand, it will say that Kaffee is Version 1.2, even though
> it doesn't ship Swing.
> 
> Stefan
> 
> --
> 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