import java.rmi.Naming;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import com.XXX.RemoteInterface.MyRemote;
/*java version "1.7.0_80"
*Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
*Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
*远程服务实现
*/
@SuppressWarnings("serial")
public class MyRemoteImpl extends UnicastRemoteObject implements MyRemote{
public String sayHello(int year) throws RemoteException {
return "I invoking this Method names sayHello() in "+year;
}
//此处为空的构造方法
public MyRemoteImpl() throws RemoteException { }
public static void main(String[] args){
try {
MyRemote service = new MyRemoteImpl();
Naming.rebind("/MyRemote/RemoteHello", service);
} catch (Exception e) {
e.printStackTrace();
}
}
}