need help to run RMI Registry

只谈情不闲聊 提交于 2019-12-06 04:38:55

command prompt took too long. Nothing happened.

Nothing is supposed to happen - the registry is running, and you can now start your server from another command prompt.

Alternatively, if you're only running the one RMI server process on this machine you can run the registry in the same process as the RMI server:

import java.rmi.*;
import java.rmi.registry.*;
import java.io.*;


public class RMIServer{

  public static void main(String[] argv) throws Exception{

    StackImp s = new StackImp(10);
    Registry reg = LocateRegistry.createRegistry(2000);
    reg.rebind("xyz", s);
    System.out.println("RMI Server ready....");
    System.out.println("Waiting for Request...");   

  }
}

This way you don't need a separate rmiregistry command, just run the server (which includes the registry) and then the client (which talks to the registry that is running in the server process).

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!