helloworldclient.java

来自「JAVA编程百例书中各章节的所有例子的源代码,包括套接字编程」· Java 代码 · 共 29 行

JAVA
29
字号
package ch05.section04;

import javax.ejb.*;
import javax.naming.*;
import java.rmi.*;
import java.util.Properties;

public class HelloWorldClient {

  public static void main(String[] args) {

    try {
      Properties props = System.getProperties();

      Context ctx = new InitialContext(props);
      HelloWorldHome home = (HelloWorldHome) ctx.lookup("HelloWorldHome");

      HelloWorldRemote helloworld = home.create();

      System.out.println(helloworld.helloWorld());

      helloworld.remove();
    }
    catch (Exception e) {
      e.printStackTrace();
    }
  }
}

⌨️ 快捷键说明

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