eg.
System.out.println("os.name "+System.getProperty("os.name"));
System.out.println("os.version "+System.getProperty("os.version"));
SDK帮助文档
java.lang.System
public static String getProperty (String prop)
Since: API Level 1
Returns the value of a particular system property or null
if no such property exists.
The properties currently provided by the virtual machine are:
java.vendor.url java.class.path user.home java.class.version os.version java.vendor user.dir user.timezone path.separator os.name os.arch line.separator file.separator user.name java.version java.home
Parameters
prop | the name of the system property to look up. |
---|
Returns
- the value of the specified system property or
null
if the property doesn't exist.
Throws
SecurityException | if a SecurityManager is installed and its checkPropertyAccess() method does not allow the operation. |
---|