server.java
来自「一个rmi程序例子」· Java 代码 · 共 56 行
JAVA
56 行
import java.rmi.*;
import java.io.IOException;
import java.net.*;
/*
* Created on 2006-6-5
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
/**
* @author lizhao
*
* TODO To change the template for this generated type comment go to Window -
* Preferences - Java - Code Style - Code Templates
*/
public class Server {
/**
* @param args
*/
public static void main(String[] args) throws IOException {
String registry = "localhost";
String registration = "";
if (args.length == 1) {
registry = args[0];
}
System.out.println("Begin to load the server!!!!!!!!\n");
try {
RMIImplement message = new RMIImplement();
registration = "rmi://" + registry + "/message";
Naming.rebind(registration, message);
} catch (MalformedURLException e) {
System.err.println(e.toString());
} catch (AccessException e) {
System.err.println(e.toString());
} catch (RemoteException e) {
System.err.println(e.toString());
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?