Hello all,
i need to submit my assignment and got a problem with my code in RMI.
can anybody take me out of the sea???
i have a simple application as follows.
client side is swing where i have a window asking for user name and password.
there is interface called inter.
i declared method validate in interface.
and there is a server.
server has a method validate.
validate is suppose to check user id and password.
the server and interface are compiled finely with no problem.
but i am getting error in client.
below is extract of my code
===========
Hello obj;//Hello is interface
String host = "127.0.0.1";
String lookupName = "xyz";
String hostName = "rmi://" +host+ "/" +lookupName;
public static void main (String [] args){
String m = "";
try{
Error here >>>>>>>obj = (Hello)Naming.lookup(hostName);
}
catch(Exception ex){}
|
|
|
|
}
public void actionPerformed (ActionEvent ae){
if (ae.getActionCommand().equals("Login")){
String uid = jtf.getText();
String pwd = jpf.getText();
obj.Validate();
}
==========
i am getting 2 errors as "Non static variable i.hostName and ii.obj cannot be referenced from a static contest.
can anybody tell me anything about the error and how to get rid of it?
also i want to know how to send parameters to the method defined in server from the client in RMI.
thank you,
sachin