Thursday, 16 February 2012

System Properties in java

To obtain properties of system on which your program is running:
import java.util.Map;

class ShowProperties {
    public static void main(String[] args) {
        for (Map.Entry e : System.getProperties().entrySet()) {
            System.out.println(e);
        }
    }
}
You can use following to get the underlying OS name
System.getProperty("os.name")

No comments:

Post a Comment