
After creating the server, the developer writes the following code to create the RMI client on the local machine:
import java.rmi.*; public class HelloClient { public static void main(String args[]) { try { Hello h = (Hello)Naming.lookup("server"); System.out.println("Client: Hello!"); System.out.println("Server: " + h.sayHello()); } catch(Exception e) { System.out.println("Error : "+e); } } } However, when the preceding code is executed it results in a RemoteException. Identify the reason behind this exception. Also, provide the correct code.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.