package dustin.examples.properties;

import java.util.Enumeration;
import java.util.Properties;
import java.util.Set;

/**
 * Lists all Java system properties.  Uses
 * Properties.stringPropertyNames for convenience,
 * but this is a Java SE 6 feature and it shows only
 * properties in which both the key and the value
 * are String types.
 */
public class JavaSystemPropertiesExample
{
  public static void main(final String[] aArgs)
  {
     System.out.println(
        "Welcome!  Here are your Java System properties:");
     Properties systemProperties = System.getProperties();
     Set<string> propertyNames =
        systemProperties.stringPropertyNames();
     for ( final String propertyName : propertyNames )
     {
        String propertyValue =
           systemProperties.getProperty(propertyName);
        if ( propertyValue.isEmpty() )
        {
           propertyValue =
              "<<<empty string>>>";
        }
        System.out.println(  propertyName
                           + " = "
                           + propertyValue );
     }
  }
}