How Java determines whether the operating system is Linux or Windows

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.