Mercurial > hg > jslab
view examples/util/DumpProperties.java @ 8:5e3cbbf173aa tip
Reorganise some more
author | samer |
---|---|
date | Fri, 05 Apr 2019 22:41:58 +0100 |
parents | bf79fb79ee13 |
children |
line wrap: on
line source
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(); } } }