/Users/lyon/j4p/src/net/rmi/ComputeClient.java
|
1 package net.rmi;
2
3 import java.rmi.RMISecurityManager;
4
5 public class ComputeClient {
6 public static void main(String args[]) {
7 System.setSecurityManager(new RMISecurityManager());
8 try {
9 lookUpServerAndExecute();
10 } catch (Exception e) {
11 e.printStackTrace();
12 }
13 }
14
15 private static void lookUpServerAndExecute()
16 throws java.rmi.NotBoundException,
17 java.net.MalformedURLException,
18 java.rmi.RemoteException {
19 String url = "rmi://localhost/ComputeServer";
20 Computable c =
21 (Computable) java.rmi.Naming.lookup(url);
22 c.println("this is cool");
23 }
24 }
25