import java.util.*; import java.net.*; import java.awt.Toolkit; /*************************************************************************** Sys -- Display System Information Invoke this application from the command line without parameters. ***************************************************************************/ class Sys { void displayFaceNames () { int i; String[] asFaceName; System.out.println ( "\n*================( CURRENT FONT FACES )=================*\n" ); asFaceName = Toolkit.getDefaultToolkit().getFontList(); for (i = 0; i < asFaceName.length; i++) { System.out.println (asFaceName[i]); } } void displayProperties () { Properties prSystem; Enumeration enPropNames; String sPropName; System.out.println ( "\n*============( CURRENT SYSTEM PROPERTIES )==============*\n" ); prSystem = System.getProperties (); enPropNames = prSystem.propertyNames(); while (enPropNames.hasMoreElements ()) { sPropName = (String) enPropNames.nextElement (); System.out.print (sPropName + " = "); System.out.println (prSystem.getProperty (sPropName)); } } void displayRuntime () { Runtime rt; InetAddress ia = null; System.out.println ( "\n*===========( CURRENT RUNTIME STATISTICS )==============*\n" ); rt = Runtime.getRuntime (); try { ia = InetAddress.getLocalHost (); } catch (Exception e) { System.out.println ("Error fetching local host name: " + e); } System.out.println ("Total Memory = " + rt.totalMemory ()); System.out.println ("Free Memory = " + rt.freeMemory ()); System.out.println ("Host Name/Address = " + ia); } void displayTrailer () { System.out.println ( "\n*=======================================================*\n" ); } public static void main (String argv[]) { Sys app; app = new Sys (); app.displayFaceNames (); app.displayProperties (); app.displayRuntime (); app.displayTrailer (); System.exit (0); } }