Hi , I think it returns nothing because
r.exec was not excecute successfully,
if you do System.out.println(p.exitValue)
it will return a value other than 0 (zero)
which mean the execuction had been failed.
Also I don't think Java allow you r.exec execute
every on one line like that.

I think there are two ways to tackle this problem

a) put your statement onto string array like this

String arr[] {"cd /usr/local/cai;","./inocucmd -SEC
-NEX > /tmp/zavironvay.pif;" };

then r.exec(arr);

b) if that does not work,
then you have to create a tempory file on your system
then write that statement onto that file
and let say your temporary script name as temp.sh

then you call r.exec(" ./temp.sh")
something like this
and remove that file after it execuate successuflly
              r.exec(" rm temp.sh"

hope this help


--- Jiri Chaloupka <[EMAIL PROTECTED]> wrote:
> hmmm ... it returns :
> ---
> $?
>
> when I do this commant on one exec() :
> p = r.exec("cd /usr/local/cai; ./inocucmd -SEC -NEX
> /tmp/zavirovany.pif;
> echo $?");
>
> ti returns nothing ...
>
> jdk is IBM JDK 1.3 ...
>
> <citov�no kdo="Rakesh Menon">
> > Change the code to :
> >
> > String line = in.readLine();
> > while (line != null) {
> >   ress = "<br>" + line;
> >   line = in.readLine();
> > }
> >
> > There is only one line to read, and its already
> read in
> > while(in.readLine() != null). After this, even if
> you try to read again
> > using in.readLine(), it will try to read next
> line, which is null. I
> > suggest to use ress as StringBuffer, if you expect
> more than 1 line and
> > use ress.append("<br>" + line).
> >
> > Hope this helps...
> > Thanks
> > Rakesh
> >
> > -----Original Message-----
> > From: Jiri Chaloupka [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, January 27, 2003 2:54 PM
> > To: [EMAIL PROTECTED]
> > Subject: trouble with readin value from
> Runtime.exec(cmd)
> >
> >
> > Hallo,
> > I have shell program, which I must call and read
> its output. On the
> > console it print some output to console and has
> some *return value*.
> > This return value I must read back to java:
> >
> > The part of code is:
> > ****************************
> > String ress = "---";
> > Process p = null;
> > try{
> >  Runtime r = Runtime.getRuntime();
> >  p = r.exec("cd /usr/local/cai; ./inocucmd -SEC
> -NEX /tmp/file.pif;
> > echo $?");
> >  BufferedReader in = new BufferedReader(new
> > InputStreamReader(p.getInputStream()));
> >
> >  while (in.readLine() != null) {
> >   ress = "<br>"+in.readLine();
> >  }
> >  in.close();
> > }catch(Exception et){
> >  out.println("Fail: "+et.toString());
> > }
> > out.println("<br>result is: "+ress+"<br>");
> >
>
***************************************************************
> > but there is no value ... (in.readLine() conatins
> null)
> >
> > Is there anything what I not comprehed good? or
> where can be way?
> >
> > Thanks
> > Jiri
> >
> >
>
==========================================================================To
> > unsubscribe: mailto [EMAIL PROTECTED] with
> body: "signoff
> > JSP-INTEREST". For digest: mailto
> [EMAIL PROTECTED] with body: "set
> > JSP-INTEREST DIGEST".
> >
> > Some relevant archives, FAQs and Forums on JSPs
> can be found at:
> >
> >  http://java.sun.com/products/jsp
> >  http://archives.java.sun.com/jsp-interest.html
> >  http://forums.java.sun.com
> >  http://www.jspinsider.com
> >
> >
>
==========================================================================To
> > unsubscribe: mailto [EMAIL PROTECTED] with
> body: "signoff
> > JSP-INTEREST". For digest: mailto
> [EMAIL PROTECTED] with body: "set
> > JSP-INTEREST DIGEST".
> >
> > Some relevant archives, FAQs and Forums on JSPs
> can be found at:
> >
> >  http://java.sun.com/products/jsp
> >  http://archives.java.sun.com/jsp-interest.html
> >  http://forums.java.sun.com
> >  http://www.jspinsider.com
>
>
> --
> Jiri Chaloupka
> B2BExpander.com
> [EMAIL PROTECTED]
> **********************************************
> http://www.b2bexpander.com/
> http://www.chalu.cz - intranet groupware solution
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with
> body: "signoff JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body:
> "set JSP-INTEREST DIGEST".
>
> Some relevant archives, FAQs and Forums on JSPs can
> be found at:
>
>  http://java.sun.com/products/jsp
>  http://archives.java.sun.com/jsp-interest.html
>  http://forums.java.sun.com
>  http://www.jspinsider.com


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com

Reply via email to