public static void main(String args[]) { try { ClientRMI cl = new ClientRMI(); } catch (RemoteException ex) { System.out.println("Server offline."); System.exit(0); } catch (NotBoundException ex) { System.out.println("Server unreachable."); System.exit(0); } }
public ClientRMI() throws RemoteException, NotBoundException { try { // betHouse - este nome identifica o objecto que o servidor regustou no registry, para o // cliente lhe aceder Registry registry = LocateRegistry.getRegistry(7000); for (String n : registry.list()) { System.out.println("> " + n); } server = (ServerInterface) registry.lookup("betHouse"); menu(); } catch (RemoteException ex) { ex.printStackTrace(); System.out.println("Server offline."); System.exit(0); } }