KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > cn > candle > demo > TestRMI


1 package cn.candle.demo;
2
3 import java.rmi.NotBoundException JavaDoc;
4 import java.rmi.RemoteException JavaDoc;
5
6 import cn.candle.rmi.Naming;
7
8 /**
9  * @author zhouj
10  *
11  */

12 public class TestRMI {
13
14     public static void main(String JavaDoc[] args) {
15         Compute compute = null;
16         try {
17             compute = (Compute) Naming.lookup("Compute");
18         } catch (RemoteException JavaDoc e) {
19             // TODO 自动生成 catch 块
20
e.printStackTrace();
21         } catch (NotBoundException JavaDoc e) {
22             // TODO 自动生成 catch 块
23
e.printStackTrace();
24         }
25         try {
26             String JavaDoc[] s = compute.calculate(new Double JavaDoc(3), new String JavaDoc[] { "",
27                     "Test" });
28             System.out.println(s[0] + " " + s.length);
29         } catch (RemoteException JavaDoc e1) {
30             // TODO 自动生成 catch 块
31
e1.printStackTrace();
32         }
33     }
34 }
Popular Tags