i was trying to run a program on RMI
i did the following
import java.rmi.*;
public interface HelloInterface extends Remote {
public int add() throws RemoteException;
}
import java.rmi.*;
import java.rmi.server.*;
public class Hello extends UnicastRemoteObject implements HelloInterface {
private int m,n,message, k,l;
public Hello (int m,int n) throws RemoteException {
k=m;
l=n;
message=k+1;
}
public int add() throws RemoteException {
return message;
}
}
after compiling these two i typed "rmic Hello"
and then this
import java.rmi.Naming;
public class HelloServer
{
public static void main (String[] argv)
{
try {
Naming.rebind ("Hello", new Hello (4,5));
System.out.println ("Server is connected and ready for operation.");
}
catch (Exception e) {
System.out.println ("Server not connected: " + e);
}
}
}
import java.rmi.Naming;
public class HelloClient
{
public static void main (String[] argv) {
try {
HelloInterface hello =(HelloInterface) Naming.lookup ("//192.168.10.201/Hello");
System.out.println (hello.add());
}
catch (Exception e){
System.out.println ("HelloClient exception: " + e);}
}
}
after compiling these two.... Type "rmicregistry" on commandprompt and press ENTER....this is not working..dos does not understand the command..help