Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.rmi.Naming;
- import java.rmi.RemoteException;
- import java.rmi.NotBoundException;
- import java.net.MalformedURLException;
- public class MensageiroClient {
- public static void main( String args[] ) {
- try {
- Mensageiro m = (Mensageiro) Naming.lookup( "rmi://localhost/MensageiroService" );
- System.out.println( m.lerMensagem() );
- m.enviarMensagem( "Hello World!" );
- }
- catch( MalformedURLException e ) {
- System.out.println();
- System.out.println( "MalformedURLException: " + e.toString() );
- }
- catch( RemoteException e ) {
- System.out.println();
- System.out.println( "RemoteException: " + e.toString() );
- }
- catch( NotBoundException e ) {
- System.out.println();
- System.out.println( "NotBoundException: " + e.toString() );
- }
- catch( Exception e ) {
- System.out.println();
- System.out.println( "Exception: " + e.toString() );
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment