Note that there are some explanatory texts on larger screens.

plurals
  1. POneed help to run RMI Registry
    primarykey
    data
    text
    <p>I'm implementing a simple RMI Server Client program in JAVA. I'm new to this actually. i have four java files. </p> <p><strong>Stack.java</strong></p> <pre><code>import java.rmi.*; public interface Stack extends Remote{ public void push(int p) throws RemoteException; public int pop() throws RemoteException; } </code></pre> <p><strong>StackImp.java</strong></p> <pre><code>import java.rmi.*; import java.rmi.server.*; public class StackImp extends UnicastRemoteObject implements Stack{ private int tos, data[], size; public StackImp()throws RemoteException{ super(); } public StackImp(int s)throws RemoteException{ super(); size = s; data = new int[size]; tos=-1; } public void push(int p)throws RemoteException{ tos++; data[tos]=p; } public int pop()throws RemoteException{ int temp = data[tos]; tos--; return temp; } } </code></pre> <p><strong>RMIServer.java</strong></p> <pre><code>import java.rmi.*; import java.io.*; public class RMIServer{ public static void main(String[] argv) throws Exception{ StackImp s = new StackImp(10); Naming.rebind("rmi://localhost:2000/xyz", s); System.out.println("RMI Server ready...."); System.out.println("Waiting for Request..."); } } </code></pre> <p><strong>RMIClient.java</strong></p> <pre><code>import java.rmi.*; public class RMIClient{ public static void main(String[] argv)throws Exception{ Stack s = (Stack)Naming.lookup("rmi://localhost:2000/xyz"); s.push(25); System.out.println("Push: "+s.push()); } } </code></pre> <p>I'm using JDK1.5. The sequence in which i compiled the files is, first i compiled Stack.java then i compiled StackImp.java then i used this command <strong>rmic StackImp</strong> this all was successful. But when i tried to run the registry this way <strong>rmiregistery 2000</strong>, command prompt took too long. Nothing happened. I'm doing this all at my home PC. And this PC is not on the network. Please suggest me what to do to successfully work with this program. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload