السلام عليكم
لمن لديه خبرة في هذا الجانب , اريد نقده و تعليقه على هذه الاكواد
Server :
import java.net.MalformedURLException;
import java.rmi.AlreadyBoundException;
import java.rmi.Naming;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
/**
*
* @author NEW
*/
interface ServerInterface extends Remote
{
public String DisplayMessage()
throws RemoteException;
}
public class Server extends UnicastRemoteObject implements ServerInterface{
private static String Message="Welcome to our server";
public Server() throws RemoteException {
super();
}
public String DisplayMessage() throws RemoteException {
return Message;
}
public static void main(String[]args)
{
try
{
Server obj=new Server();
Naming.bind("service", obj);
}
catch (RemoteException e)
{
System.out.println(""+e.getMessage());
}
catch (AlreadyBoundException e)
{
System.out.println(""+e.getMessage());
}
catch (MalformedURLException e)
{
System.out.println(""+e.getMessage());
}
}
}Client:
interface ServerInterface extends Remote
{
public String DisplayMessage() throws RemoteException;
}
public class Client {
public void main (String args[]) throws MalformedURLException
{
URL url=new URL("rmi://"+args+"/service");
try
{
ServerInterface handle=(ServerInterface)Naming.lookup("rmi;//newtech/service");
}
catch (Exception e)
{
System.out.println(""+e.getMessage());
}
System.out.println(handle.DisplayMessage);
}
}علما ان البرنامج لا يعمل , و الخطأ من اعداد الخطوات


