String OS = System.getproperty ("Os.name"); if (Os.tolowercase (). StartsWith ("Win")) { + "can ' t gunzip"); }
System class
public static Properties getProperties()
getProperty(String)
returns the current set of system properties used by the method as an Properties
object
String fileseparator = System.getproperty ("file.separator"= System.getproperty ("Webroot.path" = System.getproperty ("Line.separator");
Description of key correlation value
java.version |
Java Runtime Environment version |
java.vendor |
Java Runtime Environment Vendor |
java.vendor.url |
The URL of the Java vendor |
java.home |
Java installation directory |
java.vm.specification.version |
Java Virtual Machine Specification version |
java.vm.specification.vendor |
Java Virtual Machine Specification Provider |
java.vm.specification.name |
Java Virtual Machine Specification Name |
java.vm.version |
Java Virtual Machine Implementation version |
java.vm.vendor |
Java Virtual Machine Implementation Provider |
java.vm.name |
Java Virtual Machine Implementation name |
java.specification.version |
Java Runtime Environment Specification version |
java.specification.vendor |
Java Runtime Environment Specification vendor |
java.specification.name |
Java Runtime Environment Specification name |
java.class.version |
Java Class Format version number |
java.class.path |
Java class Path |
java.library.path |
List of paths to search when loading libraries |
java.io.tmpdir |
The default temporary file path |
java.compiler |
The name of the JIT compiler to use |
java.ext.dirs |
Path to one or more extended directories |
os.name |
Name of the operating system |
os.arch |
Architecture of the operating system |
os.version |
Version of the operating system |
file.separator |
File delimiter ("/" in UNIX system) |
path.separator |
Path Delimiter (":" In UNIX system) |
line.separator |
Row delimiter ("/n" in UNIX system) |
user.name |
User's account name |
user.home |
User's home directory |
user.dir |
User's current working directory |
http://blog.csdn.net/csdnbenbenchong/article/details/7654882
How Java determines whether the operating system is Linux or Windows