ronnieaka 0 Junior Poster in Training

my teacher gave us this basic example of rmi
the interface, server and client programs are given in order
though i know that in server side there is no bind() statement and in client a proper lookup(),and no import of registry package in server program,cause i googled up and saw other programs having them, i am still not able to run it,i want you to please see what all other problems are there in this basic "100 % correct" code as my teacher calls it

it doesn't create _skel.class and usually the exception occurs when running the client program

pls correct it or tell me what should i mod in it to get it working

Interface code:

import java.rmi.*;
import java.rmi.server.*;

public interface RemInt extends Remote
{
public String showing()throws RemoteException;
}

Server code:

import java.rmi.*;
import java.rmi.server.*;

public class RemServer extends UnicastRemoteObject implements RemInt
{
RemServer()throws RemoteException
{
super();
}

public String showing()throws RemoteException
{
return " Hello !! ";
}

public static void main(String a[])
{
try {
RemServer rserv=new RemServer();
}
catch(Exception e)
{System.out.print("Exception in server side \n");
}
}
}

Client code:

import java.rmi.*;
import java.rmi.registry.*;

public class RemClient
{

public static void main(String a[])
{
try {
RemInt remif= (RemInt)Naming.lookup("Test server");
System.out.print(remif.showing());
}

catch(Exception e)
{
System.out.print("Exception");
}
}
}

in addition to this, my teacher also pounded on me and my mates for not using different set of cmd prompts for running client and server.. i mean what problem would it create to run client and server from same prompts on which they were respectively compiled
so we have to start 4 damn different prompts.. if thats not necessary,i'm gonna throw it in her face, other wise explain to me how that will matter

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.