Saturday, July 24, 2010

Reading System Properties With JAVA

        Properties sysProp = System.getProperties();


        for (String key : sysProp.stringPropertyNames()) {
            System.out.println(key +" => "+ sysProp.getProperty(key));
        }


System.getProperties(); will return the system property as java.utill.Properties object which can easily iterated by the simple for loop. sysProp.stringPropertyNames() will return the Set of all System properties key values.

No comments:

Post a Comment