My remoteinterface import java.rmi.*; public interface myinterface extends java.rmi.

Remote { public void hello()throws java.rmi.RemoteException; } My Remoteclass import java.rmi.*; import java.rmi.registry.*; import java.rmi.server.*; public class myremote extends UnicastRemoteObject implements myinterface { public myremoteclass() throws java.rmi.RemoteException { Super(); } public void hello() throws java.rmi.RemoteException { System.out.println("hello world"); } } Registerit import java.rmi.*; class registerit { public static void main(String args[]) { try { myremoteclass robj=new myremoteclass(); System.setSecurityManager(new RMISecurityManager()); Naming.rebind("/my",robj); } Catch(Exception e) { System.out.println(e); } } } myclient import java.rmi.*; public class myclient { public static void main(String ar[]) { try { myinterface mi=(myinterface)Naming.lookup("/my"); System.out.println(mi.hello()); } Catch(Exception e) {

} } }

Sign up to vote on this title
UsefulNot useful