The role and use of System.getproperty () in Java

Source: Internet
Author: User

Java provides us with the System.getproperty () function, which can obtain some parameters of the Java JVM and the operating system, which can be used for program judgment and so on.

The System.getproperty () method needs to pass a string argument, which indicates that the environment configuration needs to be obtained.

The parameters that can be passed are:

[Java]View Plaincopy print?
  1. <span style="font-size:18px" >system.getproperty ("java.vm.version"); Java Virtual machine version
  2. System.getproperty ("Java.vendor.url"); //java official website
  3. System.getproperty ("Java.vm.nam"); //java Virtual machine name
  4. System.getproperty ("User.country"); //Country or region
  5. System.getproperty ("User.dir"); //path of the project
  6. System.getproperty ("java.runtime.version"); Java Runtime Environment version
  7. System.getproperty ("Os.arch"); //Operating system bits (32 or up)
  8. System.getproperty ("Os.name"); //operating system name
  9. System.getproperty ("sun.jnu.encoding"); //encoding format
  10. System.getproperty ("os.version"); //Operating system version
  11. System.getproperty ("java.version"); //java version version </span>

In addition, you can pass a lot of parameters, not listed here, you can directly use

[Java]View Plaincopy print?
    1. System.getproperties (). List (System.out);

This code gets all the keys and values.

The role and use of System.getproperty () in Java

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.