Re: Rmiregistry in Java Code
Paulo Melo <[email protected]>
| Newsgroups | gmane.comp.java.sun.rmi |
|---|---|
| Message-ID | <[email protected]> |
Show!!! Thank very much! (-: It's running! Thank you guys! A Paz!! Paulo Henrique --- Younes Younes <[email protected]> escreveu: > > package net.myserver.*; > > import java.rmi.*; > import java.rmi.server.*; > import java.rmi.registry.*; > import java.net.MalformedURLException; > > public class ServerStarten { > > /** Register ServerImpl object with the RMI > registry. > * @param name - name identifying the service in > the RMI registry > * @param create - create local registry if > necessary > * @throw RemoteException if cannot be exported > or bound to RMI registry > * @throw MalformedURLException if name cannot > be used to construct a valid > URL > * @throw IllegalArgumentException if null > passed as name > */ > public static void registerToRegistry(String > name, Remote obj, > boolean create) throws > RemoteException, > > MalformedURLException{ > > if (name == null) throw new > IllegalArgumentException("registration name > can not be null"); > > try { > Naming.rebind(name, obj); > } catch (RemoteException ex){ > if (create) { > Registry r = > LocateRegistry.createRegistry(Registry.REGISTRY_PORT); > r.rebind(name, obj); > } else throw ex; > } > > } > > /** Main method. > */ > public static void main(String[] args) { > System.setSecurityManager(new > RMISecurityManager()); > > try { > MyServer obj = new MyServer(); > registerToRegistry("JaBitte", obj, > true); > System.out.println("Der RMI-Server ist > unter dem Namen JaBitte > angemeldet und bereit:"); > > } catch (RemoteException ex) { > ex.printStackTrace(); > } catch (MalformedURLException ex) { > ex.printStackTrace(); > } > } > } > > >X-Original-To: [email protected] > >Delivered-To: [email protected] > >DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; > s=s1024; d=yahoo.com.br; > h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Tra > nsfer-Encoding; > b=4eqzYg8GY1WGRj2KmEdEt5VQWbx6xsz58m3hd/YCvAgqhmDBbwYmMTBbKG8jhfPYKQQs3V2O1S944A > 7C6zXFSCOGmTt5abnJVize274vhKQpW8/FeDWxiZ5EXFpCxkjsq38oW7IPBb9c+QVlbu/m/qzPDHJLQr > Uelel2SdSU56M= ; > >MIME-Version: 1.0 > >Content-Transfer-Encoding: 8bit > >Approved-By: Paulo Melo <[email protected]> > >Date: Tue, 23 Aug 2005 08:42:43 -0300 > >From: Paulo Melo <[email protected]> > >Subject: Rmiregistry in Java Code > >To: [email protected] > >X-Virus-Scanned: by amavisd-new at cs.tu-berlin.de > (including spamassassin) > >X-Spam-Status: No, hits=0 tagged_above=0 required=3 > tests= > >X-Spam-Level: > > > >Hello! > > > > Somebody knows how to start the rmiregistry in > java > >code? > > > >Thanks! > > > >A Paz!! > >Paulo Henrique > > > >__________________________________________________ > >Converse com seus amigos em tempo real com o Yahoo! > Messenger > >http://br.download.yahoo.com/messenger/ > > > >=========================================================================== > >To unsubscribe, send email to [email protected] > and include in the body > >of the message "signoff RMI-USERS". For general > help, send email to > >[email protected] and include in the body of > the message "help". > > > >For a list of frequently asked RMI questions please > refer to: > >http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html > > > >To view past RMI-USERS postings, please see: > >http://archives.java.sun.com/archives/rmi-users.html > > Younes Younes, Rechnerbetrieb Fakultät IV der > TU-Berlin, Sekr. FR 5-3 > Franklinstr. 28/29, 10587 Berlin, T. 314-25157 > > __________________________________________________ Converse com seus amigos em tempo real com o Yahoo! Messenger http://br.download.yahoo.com/messenger/ =========================================================================== To unsubscribe, send email to [email protected] and include in the body of the message "signoff RMI-USERS". For general help, send email to [email protected] and include in the body of the message "help". For a list of frequently asked RMI questions please refer to: http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html To view past RMI-USERS postings, please see: http://archives.java.sun.com/archives/rmi-users.html