See the
RMI tutorial & code.
If it helps clarify things for you, in my implementation, my "server" is just a special "administrator-mode" case of my "client," which starts up the "local" database, and then makes that database available to "normal" (i.e., remote) clients via RMI.
The normal clients
may be running on the same physical processor, however, in which case they are "remote" only in the sense of running in a different virtual machine (in which case they connect to the server via "localhost").
The "R" in RMI does stand for "remote," you know
Fly by Night Consultants<br /> <blockquote><font size="1" face="Verdana, Arial">quote:</font><hr><i>I climbed on the back of a giant albatross<br />which flew through a crack in the cloud<br />to a place where happiness reigned...<br />all year 'round<br />the music played ever so loudly!</i><p><a href="http://thomasfly.com/songs/Traffic/Hole_in_my_Shoe_qt.htm" target="_blank" rel="nofollow">Hole in My Shoe</a><hr></blockquote>