May 2001
Intermediate to advanced
1088 pages
30h 13m
English
It's extremely easy to create an RMI client. You just need to use the java.rmi.Naming class to locate the remote object in the RMI Registry. Listing 4.6 shows a client that accesses the MOTDImpl server.
package usingj2ee.motd;
import java.rmi.*;
public class MOTDClient
{
public static void main(String[] args)
{
try
{
// Locate the remote object
MOTD motd = (MOTD) Naming.lookup("//localhost/MessageOfTheDay");
// Invoke the remote method and print the result
System.out.println(motd.getMOTD());
}
catch (Exception exc)
{
exc.printStackTrace();
}
}
}
|
Unlike the server, an RMI client doesn't need to use any special security features. You don't need to see a policy file or install ...
Read now
Unlock full access