Running the Arith Distrubuted Example

On the server machine

First, start the registry.

Windows.

In the example, stay in the rmi directory.

[Recall that the class files are in c:\courses\cps530\rmi\mahmoud\ch8 and the package name is mahmoud.ch8]

Type,

start rmiregistry

This opens a child window to run the registry server in. The server runs by default on port 1099.

You can run under another port, for example,

start rmiregistry 2001

Unix.

rmiregistry 2001 &
to run in the background.

The registry is now waiting for a RMI server to register some remote objects with it.

Second, start the RMI server.

From the same directory, just type

Windows

java mahmoud/ch8/ArithImpl

Unix

java mahmoud/ch8/ArithImpl &


 

On the client machine

Just run the client program in the normal way.

java mahmoud/ch8/ArithApp


Note on ports

The code shown for this example assumes the registry runs on the default port 1099.

If it rans on, say, 2001, you would have to change the URL in the code from, for example, //Gateway or rmi://Gateway to //Gateway:2001 or rmi://Gateway:2001