My other sites

Latest News

New Summer Look :)

Java Remote Method Invocation (RMI)


RMI's Subpackages

Using RMI in 7 Simple Steps


Defines the fundamental classes and interfaces used for remote method invocation

Most of the classes are exception types

Subpackages of java.rmi provide additional, more specialised functionality

When objects must be passed as arguments to remote methods, RMI uses object serialization (


RMI's Subpackages

java.rmi.dgc ->

java.rmi.registry ->

java.rmi.server ->

Defines the classes and interfaces required for distributed garbage collection

(DGC)Defines classes required for
- a Java client to look up a remote object by name or
- a Java server to advertise the service it provides

The heart of remote method invocation. Defines classes and an interface that allow a Java program to create an object that can be used remotely by other Java programs

Using RMI in 7 Simple Steps

1. Create an iRemoteInterface that implements java.rmi.Remote and has as its interface the remote methods

2. Create the class of the remote object by implementing the iRemoteInterface and extending java.rmi.server.UnicastRemoteObject

3. Run rmiregistry

4. Instantiate the remote object and bind it with the registry using java.rmi.Naming.rebind(String, ro)

5. Compile the remote object and use rmic for stubs and skeletons

6. Write the clients using Naming.lookup() to get an iRemoteInterface reference to the remote object, after installing a RMISecurityManager

7. Execute both the server and the client