Monday, December 2, 2013

List system properties using java

This example code list available system properties using java.

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

class HelloPi {
 public static void main(String[] args) {

  Properties properties = System.getProperties();
        System.out.println(properties.toString());
        System.out.println("\n");
         
        Enumeration<String> prop = 
                (Enumeration<String>) properties.propertyNames();
         
        while(prop.hasMoreElements()){
            String propName = prop.nextElement();
            System.out.println(
                    propName + " : " +
                    System.getProperty(propName));
        }
 }
}

List system properties using java
List system properties using java

No comments: