This exercise makes use of the Hello example.
a) Open a directory for this exercise. Place the source files for the Hello example in the directory.
b) Compile HelloInterface.java and HelloImpl.java.
c) Use rmic to compile HelloImpl. Check the folder to see that the proxy classes are generated. What are their names?
d) Compile HelloServer.java . Check the contents of your folder
e) Run the server, specifying a random port number for the RMI Registry. Check the messages displayed, including the list of names currently in the registry. Do you see the name that the server registered under (as specified in the program)?
f) Compile and run HelloClient.java. When prompted, specify “localhost”for the host name, and the RMI registry port number you previously specified.
What happened? Explain.
g) Run the client program on a separate machine. Were you successful?
c. HelloImpl_Skel.class
HelloImpl_Stub.class
d. The HelloServer.class has been created.
e. C:\mliu\tmp\hello>java HelloServer
Enter the RMIregistry port number:
12345
RMI registry cannot be located at port 12345
RMI registry created at port 12345
Server registered. Registry currently contains:
Registry rmi://localhost:12345/hello contains:
rmi://localhost:12345/hello
Hello Server ready.
Yes, the name of the server is in the registry: rmi://localhost:12345/hello
f. ```
C:\mliu\tmp\hello>java HelloClient
Enter the RMIRegistry host namer:
localhost
Enter the RMIregistry port number:
12345
Lookup completed
HelloClient: Hello, World!
```
The client looks up the RMI registry to locate the remote object exported by the server. The remote method sayHello executed successfully, and the return value (“Hello, world!) is displayed.
g. Yes, RMI works fine when the client and server run on a separate machine,
You might also like to view...
When a macro group is created, only the name appears in the Navigation Pane regardless of how many ________ it contains
A) groups B) data actions C) data blocks D) submacros
Which Cisco IOS command is used to list whether an IP ACL is configured on an interface?
A) show interfaces B) show ip interface C) show ip access-list D) show ip interface brief