Professional Documents
Culture Documents
Algorithm:
1. ARPServer.java:
- Bind the remote object to the RMI registry with the name "mike".
2. StringGenerator.java:
3. ARPClient.java:
- Look up the remote object with the name "mike" from the RMI registry.
4. StringGeneratorRemote.java:
- Using Java’s random library, combine the words to turn it into a phrase.
Coding:
ARPServer.java
import java.rmi.*;
try {
Naming.rebind("rmi://localhost:5000/mike", stub);
} catch (Exception e) {
System.out.println(e);
StringGenerator.java
import java.rmi.*;
StringGeneratorRemote.java
import java.rmi.*;
import java.rmi.server.*;
super();
22IT012
ARPClient.java
import java.rmi.*;
try {
System.out.println(stub.generateString());
} catch (Exception e) {
System.out.println("Exception: " + e) } }}
Output:
Result:
Thus, RMI for the taken application has been done successfully.