** Start of listing of h1-java.cgi ** ** End of listing of h1-java.cgi ** Here is the directory entry for that file: ^ Note user execute permission needed for all CGI scripts. ** Start of listing of H1.java ** import java.util.Date; import java.text.SimpleDateFormat; import java.util.Properties; import java.util.Enumeration; public class H1 { public static void main(String args[]) { System.out.println("Content-type: text/plain"); System.out.println(""); long lTime = System.currentTimeMillis(); //System.out.println("Current millisecond count = " + lTime); Date dt = new Date(lTime); //System.out.println("Date object is " + dt); SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MMM.dd HH:mm:ss"); //System.out.println("DateFormat is " + sdf); String strTime = sdf.format(dt); System.out.println("The date&time is currently " + strTime + " in California."); Properties pr = System.getProperties(); //System.out.println("Properties: " + pr); Enumeration en = pr.propertyNames(); while (en.hasMoreElements()) { Object oKey = en.nextElement(); String sKey = (String)oKey; String sVal = pr.getProperty(sKey); //System.out.println("Key[" + sKey + "] -> [" + sVal + "]"); } String ra = pr.getProperty("cgi.remote_addr"); System.out.println("\nThe IP number " + ra + " is where your " + "client/browser is located."); String path = pr.getProperty("cgi.path"); System.out.println("\nThe PATH is " + path + " currently\n" + "(the only environment variable common to both " + "CGI and login)."); } } ** End of listing of H1.java ** Here is the directory entry for that source file and its compilation: -rw------- 1 rem user 1357 Jun 25 2005 H1.java -rw------- 1 rem user 1703 Jun 25 2005 H1.class ^ Note user execute permission *not* needed for separate program files.