In Java, the system. getproperty and system. setproperty methods.

Source: Internet
Author: User

I started to study Tomcat source code today.

At the beginning, the init method in the startup class calls the system. getproperty and system. setproperty methods many times.

Later, I found out through online search that this is a method for operating system variable operations.

System also provides a static method system. getproperties (). This method can be used to list all the variables in your system.

The result of calling system. getproperties () is.

 

, Com. IBM. util. extralibs. properties =, Java. VM. specification. vendor = Sun Microsystems Inc ., user. variant =, Java. AWT. fonts =, OS. name = Windows XP, Sun. java2d. fontpath =, Java. jcl. version = 20081016a, Sun. JNU. encoding = cp1252, Java. library. path = C:/program files/IBM/java50/JRE/bin ;.; c:/program files/ThinkPad/utilities; C:/Windows/system32; C:/windows; C:/Windows/system32/WBEM; C: /program files/IBM/infoprint select; C:/notes; C:/program files/xlview; C:/Lotus/compnent; C:/utilities; C: /program files/IBM/Personal Communications/; C:/program files/IBM/Trace facility /;

 

Here, I can call system. getproperties ("OS. Name") to obtain Windows XP.

You can determine the operating system currently in use.

We can also use this method to obtain some classpath and some other required attributes.

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.