1 package cn.candle.demo; 2 3 import java.rmi.NotBoundException ; 4 import java.rmi.RemoteException ; 5 6 import cn.candle.rmi.Naming; 7 8 12 public class TestRMI { 13 14 public static void main(String [] args) { 15 Compute compute = null; 16 try { 17 compute = (Compute) Naming.lookup("Compute"); 18 } catch (RemoteException e) { 19 e.printStackTrace(); 21 } catch (NotBoundException e) { 22 e.printStackTrace(); 24 } 25 try { 26 String [] s = compute.calculate(new Double (3), new String [] { "", 27 "Test" }); 28 System.out.println(s[0] + " " + s.length); 29 } catch (RemoteException e1) { 30 e1.printStackTrace(); 32 } 33 } 34 } | Popular Tags |