FULL PRODUCT VERSION :
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b11)
Java HotSpot(TM) Client VM (build 1.7.0-ea-b11, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
JavaDoc comment for System.getProperty method contains the following: "...if there is a security manager, its <code>checkPropertyAccess</code> method is called with the key as its argument. This may result in a SecurityException."
But there are several keys that provides an important information, that can be needful in any type of software (including Java applets) and cannot be got by any other ways. Today it is version information: "java.version", "java.vm.specification.version", "os.arch", "os.name", etc. (Before Java 1.5, there was another important property "line.separator", but now it can be retreived by String.format("%n").)
So, the current situation is strange enough. In fact, we may and should use System.getProperty("java.version") for getting Java version: there are no popular security managers that will decline this request. But according API specification we MUST NOT do this. Moreover, some user's custom security manager really may decline such property request; it, for example, may lead to unexpected failure in a Java library that calls System.getProperty("java.version") while initialization of some class. As a result, the authors of common libraries (as me) are enforced to use some unbeautiful tricks as Class.forName("SomeClassThatWasAddedInJava5") with catching exceptions to detect the current Java version.
I think it's necessary either to correct System.getProperty so that it will not call SecurityManager for some little set of standard keys, as "java.version", and document this behavior, or (I think better) to provide alternate way to get the corresponding information. For example, all version information could be incapsulated in a special "Version" class with static generation methods as "Version getJavaVersion()", "Version getVMSpecificationVersion()", "Version getPackageVersion(Package p)", etc. and access methods as "int getMajorVersion()", "int getUpdateNumber()", etc.