We can run RMI in netbeans by following steps.
Right click build.xml -> Run target -> Other targets -> startRMI
But what i need is to start RMI registry through Java code. Is it possible? Help me.
We can run RMI in netbeans by following steps.
Right click build.xml -> Run target -> Other targets -> startRMI
But what i need is to start RMI registry through Java code. Is it possible? Help me.
In your implementation Class:
YourClass extends UnicastRemoteObject implements YourService {
...
System.setSecurityManager(new java.rmi.RMISecurityManager());
registry = LocateRegistry.createRegistry( 1099 );
Naming.rebind("rmiName", this);
}
You should at first start the 'rmi server' and then the client. For this take a look at this tutorial section 'Implement the server'.
BTW: I would recommend to use hessian library which works over http!! so your admins do not need to explicitely open some ports for your app!