1031: Highlights
- If you want to run a program on a server computer, then you should use
Java's clientserver remote-method-invocation mechanism.
- Equip both the client and the server with interfaces that provide
signatures for methods to be run on the other side.
- Have the server implement
UnicastRemoteObject
and a zero-argument
constructor that calls super
.
- Be sure that all client code to be run on the server is serialized.
- Use the
Naming
class to bind on the server side and to perform
lookup on the client side.
- Compile the client class with the
javac
command, and compile the server
class with the javac
command and then the rmic
command.
- Start the RMI registry using the
rmiregistry
command.
- Start the server with the
java
command.
At this point, clients can call methods to be run on the server.