Mercurial > hg > jslab
view examples/util/DumpProperties.java @ 1:5df24c91468d
Oh my what a mess.
author | samer |
---|---|
date | Fri, 05 Apr 2019 16:26:00 +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(); } } }