How do I lookup a service in the RMI registry from an applet?

John Zukowski

For untrusted applets, the registry must be running on the web server from which it came. The necessary code follows:

String url getCodeBase().getHost();
url = "rmi://" + url + "/service";
Object obj = Naming.lookup(url);
You can then cast the returned object to whatever type you want.
0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.