Applies To : All JDK

Author(s):      Biplab Ray

Company:      Tata Consultancy Services

Created on:    13th February 2015

Author Bio:

Biplab Ray is working for Tata Consultancy Services as Assistant Consultant and development of SAP EP, composite applications using CAF, BPM, BRM, WebDynpro for Java. He also works in technologies like Java/J2EE and has depth understanding on eSOA, Webservice, Enterprise Service, XML.

Requirement :

In many situation, we might require to know the system configuration.

Implementation:

1. Create one Java class.

And Implementation as below :

import java.util.Properties;

import java.util.Set;

import java.util.Iterator;

public class MyFirstJavaProgram {

    public static void main(String []args) {

 

       Properties prop = System.getProperties();

       Set<String> set = prop.stringPropertyNames();

 

       Iterator<String> itr = set.iterator();

       while(itr.hasNext()){

           String string_Key = itr.next();

           String string_Value = prop.getProperty(string_Key);     

           System.out.println(string_Key + ” : ” + string_Value);

       }

     }

}

Output Like Below:

java.runtime.name : OpenJDK Runtime Environment.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply