How to Start an RMI Example

  1. Make a directory where you want this stuff
    mkdir /home/fred/rmi

  2. CD into that directory
    cd /home/fred/RMI

  3. Copy the date example into the directory
    cp /home/rappleto/pub/Classes/RMI/DateExample/*.java .
    Or get it at http://euclid.nmu.edu/~randy/Classes/RMI/DateExample
    You need the *.java files and the policy.txt file.

  4. Edit the client and server to use a unque port
    java.rmi.Naming.rebind("rmi://euclid.nmu.edu:1099/count",v);
    s=(RemoteInterface))java.rmi.Naming.lookup("rmi://euclid.nmu.edu:1099/count");

  5. Compile the remote object. Note that you do not name the file, but the class (don't say blah.java, just blah). This should create a *Stub*  file.
    javac RemoteObject.java
    rmic RemoteObject (Only for very old systems)

  6. Compile the client and the server
    javac Client.java
    javac Server.java

  7. Maybe start the RMI registry on a unique port number.  You should start it if is's not already running, and your server program doesn't start it automatically.  I use 1099.  You pick your own. The code I give you starts on, so this is unneccesary.
    rmiregistry 1099 &

  8. Start the server
    java -Djava.security.policy=policy.txt Server &

  9. Start the client
    java -Djava.security.policy=policy.txt Client


And it should work!