System. setproperty ()

Source: Internet
Author: User


/*
* Set the system attributes of the specified key-pair Value
* Setproperty (string prop, string value );
*
* Number of shards:
* Prop-name of the system property.
* Value-value of the system attribute.
*
* Return value:
* If there is no previous value in the system attribute, null is returned.
*
* Throw:
* Securityexception-assume that the security manager exists and its checkpermission method does not agree to set the specified attribute.
* Nullpointerexception-assume that the key or value is null.
* Illegalargumentexception-assume that the key is null.
* Note: The system here refers to the JRE (runtime) system, not the OS.
*
*/

// Instance
System. setproperty ("property1", "ABC ");
System. setproperty ("property2", "def ");

// Set the first worker number as the global variable of the system! It can be obtained by system. getproperty ("variable"); in no matter where the project is located,

// System. setproperty is equivalent to a static variable, which exists in the memory!

 

System. setproperty ()

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.