Home Java Java-get-example Java get System Properties



Java get System Properties
Posted on: November 1, 2008 at 12:00 AM
In this section, you will learn how to obtain the system properties. The System class provides a Properties object that describes the configuration of the current working environment of the system.

Java get System Properties

     

In this section, you will learn how to obtain the system properties. The System class provides a Properties object that describes the configuration of the current working environment of the system. System properties provides several information related to the system, user or version etc. The Enumeration class generates the series of elements.

 System.getProperties()-This method determines the current system properties.

Here is the code of GetSystemProperties.java

import java.util.*;

class  GetSystemProperties{
  public static void main(String[] args) {
  Properties prop = System.getProperties();
  Enumeration keys = prop.keys();
  while (keys.hasMoreElements()) {
  String key = (String)keys.nextElement();
  String value = (String)p.get(key);
  System.out.println(key + ": " + value);
 }
  }
}

Output will be displayed as:

Download Source Code

 

Related Tags for Java get System Properties:
cconfigurationideclassormformpropertiesobjectiouserformatversionsystemenvironmentvienumerationthisidaielementconfigelementsforieworktolearninformationeargenerateeildesrsisectionusepecurrentinseriesrminfoasmntjclesworkingemmehowobjprorateratesenvenumdescribesystierelsatratiolatekisirironhainfllpropereaarconfrelatertropescrssrirenthbesstatihatetcetcinforminformatjepropprono


More Tutorials from this section

Ask Questions?    Discuss: Java get System Properties  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.