Mercurial > hg > jslab
view examples/util/DumpProperties.java @ 3:15b93db27c04
Get StreamSource to compile, update args for demo
author | samer |
---|---|
date | Fri, 05 Apr 2019 17:00:18 +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(); } } }