1

This is my first time using java rmic so I was trying to run a sample program but faced an error this is the code I copied it from :http://learnersdashboard.blogspot.com/2015/07/rmi-addition-of-2-numbers-example.html now it is showing the following error :- error: Invalid class file format in ./AdderRemote.class. The major.minor version '61.0' is too recent for this tool to understand. error: Class AdderRemote not found. 2 errors //Remote Interface import java.rmi.*;

public interface Adder extends Remote{  
public int add(int x,int y)throws RemoteException;  
}  
//Implementation of remote interface
import java.rmi.*;  
import java.rmi.server.*;  
public class AdderRemote extends UnicastRemoteObject implements Adder{  
AdderRemote()throws RemoteException{  
super();  
}  
public int add(int x,int y){return x+y;}  
}  
//Server
import java.rmi.*;  
import java.rmi.registry.*;  
public class MyServer{  
public static void main(String args[]){  
try{  
Adder stub=new AdderRemote();  
Naming.rebind("rmi://localhost:5000/sonoo",stub);  
}catch(Exception e){System.out.println(e);}  
}  
}  
//Client Application
import java.rmi.*;  
public class MyClient{  
public static void main(String args[]){  
try{  
Adder stub=(Adder)Naming.lookup("rmi://localhost:5000/sonoo");  
System.out.println(stub.add(34,4));  
}catch(Exception e){}  
}  
}   

[error image][1]
  • The problem I find with the Internet is that many articles don't display the date that they were written. You should try the [RMI](https://docs.oracle.com/javase/tutorial/rmi/index.html) lesson in Oracle's Java tutorials. It applies to JDK 8. You no longer need to use _rmic_. Refer to this SO question: [Is rmic still needed?](https://stackoverflow.com/questions/4702882/is-rmic-still-needed) – Abra Feb 22 '22 at 10:20

0 Answers0