This code works fine with jdk1.1.6v4a , it gets stdout and stderr back
from running "ls"
i am using slackware 3.5 with libc5

Mark Hofmann wrote:

> Hi all,
> I encountered a problem when I start a prog from my
> java-prog and
> try to get the stdout or stderr.
> The problem is, that I wrote the code with jdk-1.1.3,
> changed my
> system to Redhat 5.1 (with glibc)  and jdk-1.1.6 and now it
> doesn't
> work anymore. As long as stdout is empty there are no
> problems
> but when the prog tries to read the messages it simply
> hangs.
> To make myself a bit clearer, here is the code:
>
> ......
>     Process process1;
>     String msg=new String();
>     Runtime run1=Runtime.getRuntime();
>     try {
>        process1=run1.exec(command);
>        InputStream in=process1.getInputStream();
>        BufferedReader in_read=new BufferedReader(new
> InputStreamReader(in));
>         //  it's happening here:
>        while((msg=in_read.readLine()) != null){
>            System.out.println(msg);
>        }
>    ....
>
> Hope somebody knows a solution for that.
>
> Thanks in advance
>
>      Mark


Reply via email to