How to determine Java version is at least 6?

L

lemmi

Hi,

is there a way to check whether the Java version being used is AT
LEAST version 6? My application has a nice UI feature that is only
nice if Java 6 or higher is being used. 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?

Dirk
 
A

Andrew Thompson

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
 
L

lemmi

Thanks Andrew, I guess I will go with option 3 and do a
Float.parseFloat() on the
returned value for system property "java.specification.version".

BTW, the feature is simply a small animation that changes the size of
a top level Swing window, so that it seems to slide into its parent
window. With Java 5 you get a lot of flickering, which makes this
feature useless. It is supposed to be eye candy, so it better look
good.

Dirk
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,586
Members
45,090
Latest member
ActivlifeKetoDiet

Latest Threads

Top