The Java Developers Almanac 1.4


Order this book from Amazon.

   
Home > List of Packages > java.lang  [58 examples] > System Properties  [3 examples]

e88. Listing All System Properties

    // Get all system properties
    Properties props = System.getProperties();
    
    // Enumerate all system properties
    Enumeration enum = props.propertyNames();
    for (; enum.hasMoreElements(); ) {
        // Get property name
        String propName = (String)enum.nextElement();
    
        // Get property value
        String propValue = (String)props.get(propName);
    }

 Related Examples
e86. Getting and Setting the Value of a System Property
e87. Setting the Value of a System Property from the Command Line

See also: Arrays    Assertions    Classes    Commands    Numbers    Objects    Strings    Threads   


© 2002 Addison-Wesley.