Tutorials

Jini Example
Jxta Example
Web Services

Related

Jxta
Jini
Web Services

For More Info

From P2P to Web Services and Grids: Peers in a Client/Server World
Ian J. Taylor, 2004
Publisher: Springer
ISBN: 1-85233-869-5

RMI Example

This is a simple RMI example that does a 'Hello World' type call on a remote machine using RMI. It consists of three files:

  1. RemoteMessageInterface.java: This is the Java RMI proxy object to the remote implementation of this code that the client calls locally.
  2. RemoteMessage.java: This is the remote implementation of the Java proxy that is run on the remote machine
  3. LocaLObject.java: This is the local client that calls the Java proxy (RemoteMessageInterface) that transmits this call over the network to call the function in the remote object (RemoteMessage).

Batch Files

This example is configured to run the client and the server on ONE machine. Although this is not distributed in the network sense the principles are exactly the same. You are welcome to reconfigure the code to insert an IP address of a remote machine if you want to run this across the network.

  • build.bat: compiles the example and creates the local stubs file needed.
  • runRegistry.bat: You must run this first on the remote machine. It is the RMI registry that keeps track of the RMI objects that are currently available on the remote machine.
  • runRemote.bat: This is a batch file that uses the java.policy file to set up the security model (all permissions granted in this example) and runs the RMI Service, RemoteMessage.
  • runLocal.bat: Again, uses the java.policy file to set up the security model and runs the RMI client, LocaLObject.