📄 remserver.java
字号:
import java.rmi.*;
import java.net.*;
public class RemServer
{
public static void main(String[] args)
{
/*
Create and install a security manager,The main method of the server
first needs to create and install a security manager;
either the RMISecurityManager or one that you have defined yourself.
A security manager needs to be running so that it can guarantee that
the classes that get loaded do not perform operations that they are
not allowed to perform. If no security manager is specified no class
loading, by RMI clients or servers, is allowed, aside from what can
be found in the local CLASSPATH.
*/
/*
if (System.getSecurityManager() == null)
{
System.setSecurityManager(new RMISecurityManager());
}
*/
try
{
/*
The main method of the server needs to create one or more instances
of the remote object implementation which provides the service.
*/
RemImpl localObject=new RemImpl();
/*
For bootstrapping, the RMI system provides a remote object registry
that allows you to bind a URL-formatted name of the form
"//host/objectname" to the remote object, where objectname is a simple
string name.For example, the following code binds the name "Rem" to a
reference for the remote object.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -