Advertisement
Guest User

Untitled

a guest
Jul 24th, 2014
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.53 KB | None | 0 0
  1. package timeexample;
  2. import java.rmi.*;
  3.  
  4. public class TimeClient {
  5.     // MAIN
  6.     public static void main(String[] args) {
  7.         String host = "localhost";
  8.         int port = 1099;
  9.         try {
  10.             TimeService ts = (TimeService) Naming.lookup("//" + host + ":" + port + "/" + TimeService.SERVICE_NAME);
  11.             System.out.println(ts.getTime());
  12.         } catch (java.net.MalformedURLException mue) {
  13.             mue.printStackTrace();
  14.         } catch (NotBoundException nbe) {
  15.             nbe.printStackTrace();
  16.         } catch (RemoteException re) {
  17.             re.printStackTrace();
  18.         }
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement