java 如何通过java代码启动RMI Registry?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10447300/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 01:05:04  来源:igfitidea点击:

How to start RMI Registry through java code?

javaclientrmirmiregistry

提问by Andy

I have written java programs for Client and Server. But, to run the program I need to start rmi registry manually! How to start RMI registry through java code (through Server)?

我已经为客户端和服务器编写了 java 程序。但是,要运行该程序,我需要手动启动 rmi 注册表!如何通过java代码(通过Server)启动RMI注册?

回答by skaffman

Use LocateRegistry.createRegistry(port). See javadoc.

使用LocateRegistry.createRegistry(port). 请参阅javadoc

回答by Dani

First, you need execute in java bin folder "start rmiregistry" throught shell/command line (create CLASSPATH system var to java class/jar to the project to register in RMI Register, RMI Registry need know their classes).

首先,您需要通过shell/命令行在java bin文件夹“start rmiregistry”中执行(创建CLASSPATH系统变量到java类/jar到项目以注册到RMI Register,RMI Registry需要知道它们的类)。

Before you can use LocateRegistry.getRegistry().

在您可以使用 LocateRegistry.getRegistry() 之前。