Hello Friends,
I used one interface and implementation class to invoke RMI they are as follows
package com.rmi;
import java.rmi.Remote;
public interface CountRMI extends Remote {
public int sum() throws java.rmi.RemoteException;
public void sum(int _val) throws java.rmi.RemoteException;
public int increment() throws java.rmi.RemoteException;
}
package com.rmi;
import java.rmi.server.UnicastRemoteObject;
import java.rmi.*;
public class CountRMImpl extends UnicastRemoteObject implements CountRMI {
private int sum;
public CountRMImpl(
String name) throws RemoteException{
super();
try{
Naming.rebind(name, this);
sum=0;
}
catch(Exception e){
System.out.println("Exception:" + e.getMessage());
e.printStackTrace();
}
}
public int sum() throws RemoteException{
return sum;
}
public void sum(int _val) throws RemoteException{
sum = _val;
}
public int increment() throws RemoteException{
return ++sum;
}
Implementation class, when I compile both and run rmic CountRMImpl I got the following error,
public class CountRMImpl extends UnicastRemoteObject implements CountRMI
^
Error is stated at CountRMI
please help me to over come this.
Thanks,
Bhargavi.