📄 helloworldrmiclient2.java
字号:
// HelloWorldRMIClient2.java
import java.rmi.*;
import javax.rmi.*;
import javax.naming.*;
public class HelloWorldRMIClient2 {
public static void main(String[] args) {
if (args.length == 0) {
System.err.println("Usage : HelloWorldRMIClient2 <objName>");
System.exit(-1);
}
try {
Context initialNamingContext = new InitialContext();
HelloWorld2 helloWorld2Obj =
(HelloWorld2) PortableRemoteObject
.narrow(initialNamingContext.lookup(args[0]), HelloWorld2.class);
String response = helloWorld2Obj.hello();
System.out.println("RMI-IIOP Client : The response is '" + response
+ "'\n");
} catch (Exception e) {
System.out.println("Exception : " + e);
e.printStackTrace(System.out);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -