Java Reference
In-Depth Information
To generate RMI stubs for our application, run rmic 19 against the class
that implements the remote interface:
penfold$ rmic net.multitool.RMIDemo.SessionImpl
When you are writing “traditional” Java RMI, that is just about all you
need to know about rmic . The program actually has a large number of options
and switches, but most of these are to support alternate protocols and systems,
such as CORBA IDL and IIOP. If you know what these are, and make use of
these, you will find details on these options in Sun's rmic tool documentation. 20
5.8.3
The rmiregistry is a naming service that binds RMI server stubs to simple
names. Invoking it is incredibly simple. Just type rmiregistry . You may want
to run it on other than the default port (1099). For that, just specify the port
number on the command line:
The rmiregistry Tool
$ rmiregistry 21099 &
That example shows us running a registry on port 21099 and running it
in the background. You might want to use a nonstandard port in order to run
a test version of the service while the production version remains available on
the standard port.
That is just about all there is to rmiregistry . You can find details in the
Sun Java SDK documentation.
5.8.4
So far, we have written an RMI interface, a server implementation, and a client
implementation. We have generated RMI stubs for our RMI object. We are
Setting Up Servers and Clients
19. Be careful! If you have one or more Java SDKs installed and you have the GNU Compiler
for Java installed, watch out for your PATH . The Java compiler and the Java runtime from the
JDK don't collide with gcj because the compiler has a different name and gcj compiles to native
binaries. But gcj does have an rmic compiler, and it is usually in /usr/bin , which is usually
ahead of your JDK in the executable path. If you run rmic and it explodes with errors, make
sure you aren't running the rmic from gcj against .class files from a JDK. (And, yes, this bit
me and had me confused for a while!)
20. http://java.sun.com/j2se/1.4.2/docs/tooldocs/solaris/rmic.html
Search WWH ::




Custom Search