helloclient.java

来自「100多M的J2EE培训内容」· Java 代码 · 共 35 行

JAVA
35
字号
package bible.rmi.example1;import weblogic.rmi.*;import weblogic.common.*;/** * HelloClient finds the HelloServer via a Naming lookup and calls * the HelloServer's remote method sayHello. */public class HelloClient {  /**   * Logical name used to look up the remote HelloServer.   */  public final static String SERVERNAME = "rmi://localhost:7001/HelloServer";  /**   * Does a Naming lookup for the HelloServer and says hello.   * @param argv   */  public static void main(String[] argv) {    try {      HelloInterface obj = (HelloInterface) Naming.lookup(SERVERNAME);      System.out.println("Successfully connected to HelloServer.");      String message = obj.sayHello();      System.out.println(message);    } catch (Throwable t) {      t.printStackTrace();      System.exit(-1);    }  }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?