import java.rmi.*; public class TimeStampClient { static public void main(String args[]){ // variable to store the information provided by remote object String whatTimeIsIt; // attempt to call the remote object try { // obtain a reference to the remote object in the registry TimeStampIF obj = (TimeStampIF)Naming.lookup("rmi://serverNameIP/TimeStampService"); // invode the remote method (getTimeStamp) and store the results whatTimeIsIt = obj.getTimeStamp(); System.out.println("TimeStamp = "+whatTimeIsIt); } catch (Exception e) { // and if it fails... System.out.println("TimeStampService exception: " + e.getMessage()); e.printStackTrace(); } // end try/catch exeception } // end main } // end TimeStampClient.class