JDK-4216988 : (process) JVM 1.2 hangs when executing external
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 1.2.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_95
  • CPU: x86
  • Submitted: 1999-03-03
  • Updated: 1999-08-24
  • Resolved: 1999-08-24
Related Reports
Duplicate :  
Description

Name: dbT83986			Date: 03/03/99


// Compile and run the Java class below. The JVM will hang. It works fine under JDK 1.1.7

// Source code (please note this is an example -with minor modifications to adapt it to Windows- taken from the book "Java
// Class Libraries Second Edition, Volume 1; page 1365):

import java.io.*;

public class ls
{
    public static void main(String[] args)
    {
        try
        {
            String cmd = "ls.bat";
            Process child = Runtime.getRuntime().exec(cmd);
            InputStream in = child.getInputStream();
            int c, newline = 0, maxlines = 10;
            if (args.length > 0)
                maxlines = Integer.parseInt(args[0]);
            while ((c = in.read()) != -1 && newline < maxlines)
            {
                char ch = (char)c;
                System.out.print(ch);
                if (ch == '\n')
                    ++newline;
            }
            in.close();
            child.destroy();
        }
        catch (IOException ioe)
        {
            System.err.println(ioe);
        }
    }
}
(Review ID: 52231)
======================================================================

Comments
EVALUATION It is well known Runtime.exec problem in 1.1.x. The problem is largely fixed in 1.2. But there are still many spec issues need to be solved. Without clear spec, we can not implement correct behavior. ###@###.### 1999-08-24
24-08-1999