Setting and Getting System Properties

System.setProperty("timezone",
											"EasternStandardTime");
											String zone = System.getProperty("timezone");

System properties are key/value pairs that are external to your Java application. The Java System object provides a mechanism for reading the names and values of these external system properties into your Java application. The preceding phrase shows how you can set and get a system property using the Java System object.

You can also retrieve all the system properties into a properties object using the following statement:

Properties systemProps = System.getProperties();

There is also a method for retrieving just the system property names. The following code snippet shows how you can retrieve all the system ...

Get Java™ Phrasebook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.