ArticlesProjectsWeeklyCredentialsAbout

Java RMI Server and Client (1997)

A complete RMI example: a remote interface, a server implementation registered in the RMI registry, and a client that calls methods across the network — no external frameworks.

javarmidistributed-systemsnetworking

Remote interface, server skeleton, and client stub — the complete RMI stack from a 1997 Motorola project.

Source code
# Java RMI Server and Client (1997)

Code from the article [Java RMI: Calling Methods Across the Network](https://rishisharma.in/articles/rmi-distributed-java).

Requires Java 1.1. Uses the built-in `rmiregistry` — no external dependencies.

```sh
mkdir -p build
find src -name '*.java' | xargs javac -d build

# Generate stubs and skeletons (Java 1.1 rmic)
rmic -d build com.motorola.nms.rmi.DeviceServiceImpl

# Start the RMI registry on port 1099
rmiregistry 1099 &

# Start the server
java -cp build com.motorola.nms.rmi.DeviceServer

# In another terminal — call the remote service
java -cp build com.motorola.nms.rmi.DeviceClient localhost GET_STATUS router-gw1
```

## Contents

- `src/com/motorola/nms/rmi/DeviceService.java` — remote interface (extends `java.rmi.Remote`)
- `src/com/motorola/nms/rmi/DeviceServiceImpl.java` — server-side implementation (`UnicastRemoteObject`)
- `src/com/motorola/nms/rmi/DeviceServer.java` — binds the implementation into the RMI registry
- `src/com/motorola/nms/rmi/DeviceClient.java` — looks up the registry and calls the remote method