Guest User

Untitled

a guest
May 30th, 2012
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.23 KB | None | 0 0
  1.     import java.rmi.Naming;  
  2.     import java.rmi.RemoteException;  
  3.     import java.rmi.NotBoundException;  
  4.     import java.net.MalformedURLException;  
  5.      
  6.     public class MensageiroClient {  
  7.      
  8.         public static void main( String args[] ) {  
  9.             try {  
  10.                 Mensageiro m = (Mensageiro) Naming.lookup( "rmi://localhost/MensageiroService" );  
  11.                 System.out.println( m.lerMensagem() );  
  12.                 m.enviarMensagem( "Hello World!" );  
  13.             }  
  14.             catch( MalformedURLException e ) {  
  15.                 System.out.println();  
  16.                 System.out.println( "MalformedURLException: " + e.toString() );  
  17.             }  
  18.             catch( RemoteException e ) {  
  19.                 System.out.println();  
  20.                 System.out.println( "RemoteException: " + e.toString() );  
  21.             }  
  22.             catch( NotBoundException e ) {  
  23.                 System.out.println();  
  24.                 System.out.println( "NotBoundException: " + e.toString() );  
  25.             }  
  26.             catch( Exception e ) {  
  27.                 System.out.println();  
  28.                 System.out.println( "Exception: " + e.toString() );  
  29.             }  
  30.         }  
  31.     }
Advertisement
Add Comment
Please, Sign In to add comment