This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Distributed Java and the fly likes rmi Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "rmi" Watch "rmi" New topic


Ranch Hand

Joined: Nov 22, 2008
Posts: 18944

hello every body

these r prorams i have wriiten to pass arg to forvenu.exe
which residing on remote machine i want to pass arg from
client machine and get the result on client machine,i am
unable to get it.please help me regarding this
for example
at client's machine dos prompt
c>forvenu 3 4
it should all the process on remote machine and get
result back to client machine as
Note:the programs are written for testing on Standalone
macine so that is why in the client program,the remote
macine name is not specified.
//This is interface prog
import java.rmi.*;
public interface Hello extends Remote
public int add(int a,int b)throws RemoteException;
//This is Implementatiom prog
import java.rmi.server.*;
import java.rmi.*;
public class HelloImpl extends UnicastRemoteObject implements Hello , Serializable
public HelloImpl() throws RemoteException
public int add(int u,int v) throws RemoteException
int rk=0;
String line="";
Process p=null;
Runtime r=Runtime.getRuntime();
p=r.exec("forvenu.exe"+" "+"u"+" "+"v");
BufferedReader kbdin= new BufferedReader(new InputStreamReader(p.getInputStream()));
Integer ff=new Integer(line);
}catch(Exception e){e.printStackTrace();}
return rk;
//This is server prog
import java.rmi.*;
public class Ser
public static void main(String s[]) throws Exception
Hello h=new HelloImpl();
System.out.println("Server is ready");

//This is client prog
import java.rmi.*;
import java.rmi.server.*;
public class Clt implements Serializable
public static void main(String s[]) throws Exception
Integer p=Integer.valueOf(s[0]);
Integer q=Integer.valueOf(s[1]);
int u=p.intValue();
int v=q.intValue();
//Hello h=(Hello)Naming.lookup("rmi://");
Hello h=(Hello)Naming.lookup("ccc");//first to test on stand alone system
thank you

Joined: Mar 06, 2000
Posts: 3
If you are using java 1 then you should the securityManager to RMISecurityManager
setSecurityManager(new RMISecurityManager());
But, if you are already using java 2.0 then, may be there is a problem in exec() method i.e while.
Durga Prasad Babu Pratapani
I agree. Here's the link:
subject: rmi
It's not a secret anymore!