Re: How to determine Java version is at least 6?
lemmi wrote:
...
is there a way to check whether the Java version being used is AT
LEAST version 6?
No. There are at least three.
..My application has a nice UI feature that is only
nice if Java 6 or higher is being used.
1) Web start - to handle versioning and possibly
prompt the user to upgrade if they have lower version.
<http://www.physci.org/jws/version.html>
2) try/catch. Try to perform the behaviour (what is it?)
and if the method does not exist, the app. will throw
a NoSuchMethodError or similar.
3) java.specification.version *
...Lower versions result in the
good old flickering behaviour. I know there is the "java.version"
system property but how can I efficiently check this ... depending on
the vendor it might have any kind of string in it, so I can't just
convert it to a float, right?
* Right, but there are a variety of other java properties
that might give better float results, like the aforementioned
j.spec.version, see some of them through the app. here..
<http://www.physci.org/jws/#jtest>
(dump all the properties to the command line - you
might find something better still)
HTH
--
Andrew Thompson
http://www.athompson.info/andrew/
Message posted via http://www.javakb.com