O'Reilly logo

Java™ Phrasebook by Timothy Fisher

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required