Код: Выделить всё
public static void main(String[] args) {
try {
Registry registro = LocateRegistry.getRegistry();
EchoInt stub = (EchoInt) UnicastRemoteObject.exportObject(new EchoObjectRMI(), 0);
// bind (or rebind) the stub into the local registry
registro.rebind("echoRemote", stub);
} catch (RemoteException e) {
System.err.println("Something wrong happended on the remote end");
e.printStackTrace();
System.exit(-1); // can't just return, rmi threads may not exit
}
System.out.println("The echo server is ready");
}
}
Код: Выделить всё
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Unreachable catch block for RemoteException. This exception is never thrown from the try statement body
at server.EchoObjectRMI.main(EchoObjectRMI.java:33)
Подробнее здесь: https://stackoverflow.com/questions/791 ... ception-in
Мобильная версия