I need to work around a Java bug in JDK 1.5 which was fixed in 1.6. I’m using the following condition:
if (System.getProperty("java.version").startsWith("1.5.")) {
...
} else {
...
}
Will this work for other JVMs? Is there a better way to check this?
These articles seem to suggest that checking for
1.5or1.6prefix should work, as it follows proper version naming convention.Sun Technical Articles
java.versionsystem property”java.versionsystem property”