Oliver,
I'm not quite sure if you need this additional info or not, but here goes:
If you notice, createRegistry method throws a RemoteException if the registry "cannot be exported." Take a look at the Javadoc.
The usual reason for this exception is that the RMI registry (or something else) is already running on that port. However, if you really want to make sure, you can use a java.net.ServerSocket to make sure nothing else is running on the user-specified port like this:
However, I honestly believe just catching the RemoteException and telling the user there was a problem starting the registry is more than enough for the assignment.
Also,
you should check with a getRegistry call after createRegistry fails to see if the RMI registry is the one that is running on your specified port, or something else (if it is the RMI registry that was running, your job is already done, right?).
Hope this helps. Let me know if you need further clarification...
Reza
[ June 10, 2005: Message edited by: Reza Rahman ]