/Users/lyon/j4p/src/net/rmi/rmiSynth/RMIClient.java
|
1 //This class was created automatically by CentiJ
2 package net.rmi.rmiSynth;
3
4 import java.rmi.NotBoundException;
5 import java.rmi.RemoteException;
6 import java.rmi.registry.LocateRegistry;
7 import java.rmi.registry.Registry;
8
9 public class RMIClient {
10
11
12 public static void main(String args[]) {
13 try {
14 example();
15
16 } catch (Exception e) {
17 e.printStackTrace();
18 }
19
20 }
21
22 private static void example()
23 throws RemoteException,
24 NotBoundException {
25 RMIInterface rs = getProxy();
26 //Type in your remote procedure calls below
27 System.out.println(rs.getHello());
28 }
29
30 private static RMIInterface getProxy()
31 throws RemoteException,
32 NotBoundException {
33 Registry r = getRegistry();
34 RMIInterface rs = (RMIInterface) r.lookup(
35 RMIInterface.SERVER_NAME);
36 return rs;
37 }
38
39 private static Registry getRegistry()
40 throws RemoteException {
41 //locate the server class on remote machine
42 Registry r = LocateRegistry.getRegistry(
43 "localhost");
44 return r;
45 }
46
47 }