java类库详细讲解
源代码在线查看: lookupremote.html
Looking Up a Remote Object and Invoking a Method
(Java Developers Almanac Example)
BODY CODE {font-family: Courier, Monospace; font-size: 11pt} TABLE, BODY {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt} PRE {font-family: Courier, Monospace; font-size: 10pt} H3 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11pt} A.eglink {text-decoration: none} A:hover.eglink {text-decoration: underline} -->
The Java Developers Almanac 1.4
Order this book from Amazon.
Home
>
List of Packages
>
java.rmi
[6 examples]
e189.
Looking Up a Remote Object and Invoking a Method
try {
// Look up remote object
RObject robj = (RObject) Naming.lookup("//localhost/RObjectServer");
// Invoke method on remote object
robj.aMethod();
} catch (MalformedURLException e) {
} catch (UnknownHostException e) {
} catch (NotBoundException e) {
} catch (RemoteException e) {
}
Related Examples
e187.
Starting the RMI Registry
e188.
Defining and Exporting a Remote Object
e190.
Passing Parameters to a Remote Method
e191.
Returning Values from a Remote Method
e192.
Throwing an Exception from a Remote Method
© 2002 Addison-Wesley.