1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
package examples;
import javax.naming.Context;
import javax.naming.InitialContext;
import java.util.Properties;
public class HelloClient {
public static void main(String[] args) throws Exception {
Properties props = System.getProperties();
Context ctx = new InitialContext(props);
Object obj = ctx.lookup("HelloHome");
HelloHome home = (HelloHome) javax.rmi.PortableRemoteObject.narrow(obj, HelloHome.class);
Hello hello = home.create();
System.out.println(hello.hello());
hello.remove();
}
} |
Partager