⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 helloworldrmiclient2.java

📁 21天学通java的示例程序源代码
💻 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 + -