Mercurial > hg > jslab
diff examples/util/DumpProperties.java @ 0:bf79fb79ee13
Initial Mercurial check in.
author | samer |
---|---|
date | Tue, 17 Jan 2012 17:50:20 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/util/DumpProperties.java Tue Jan 17 17:50:20 2012 +0000 @@ -0,0 +1,38 @@ +package eg.util; + +import java.util.Properties; +import java.util.Enumeration; + +import java.net.InetAddress; + +public class DumpProperties + { + public static void main(String[] args) + { + Properties props = System.getProperties(); + Enumeration enum = props.propertyNames(); + + System.out.println("System Properties"); + while( enum.hasMoreElements() ) + { + String key = (String)enum.nextElement(); + String value = props.getProperty(key); + System.out.println(key + "\t" + value); + } + + try + { + InetAddress host = InetAddress.getLocalHost(); + String name = host.getHostName(); + String addr = host.getHostAddress(); + + System.out.println("hostname = " + name); + System.out.println("address = " + addr); + } + catch ( Exception e ) + { + System.err.println("Exception looking up local host name"); + e.printStackTrace(); + } + } + } \ No newline at end of file