????Java?????????????Java RMI??Java Remote Method Invocation????Java???????????????????????????????ó?????????????????????е???????????????????????????????????????Java??????????????繃???з????????RMI???????????????????????????á?
????Java RMI?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????

 

import java.rmi.Remote;
import java.rmi.RemoteException;
public interface RmiTestInterface extends Remote{
public String getTest() throws RemoteException;
}

????????????

 

import java.rmi.RemoteException;
public class RmiTestImpl implements RmiTestInterface {
public RmiTestImpl() throws RemoteException {
//super();
// TODO Auto-generated constructor stub
//UnicastRemoteObject.exportObject(this);
}
/**
*
*/
public String getTest() throws RemoteException {
// TODO Auto-generated method stub
return "Hello??Test";
}
}

???????????main??????????????????RMI????????????????

 

public static void main(String []args) throws AlreadyBoundException?? RemoteException{
RmiTestImpl t=new RmiTestImpl();
RmiTestInterface tt=(RmiTestInterface)UnicastRemoteObject.exportObject(t??0);
// Bind the remote object's stub in the registry
Registry registry = LocateRegistry.createRegistry(2001);
registry.rebind("test"?? tt);
System.out.println("server is start");
}