Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4206776

(process) exec() Works right in JDK1.0 but fails in JDK1.16

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Fix
    • P4
    • None
    • 1.1.6, 1.1.7
    • hotspot
    • x86
    • windows_95

    Description



      Name: dbT83986 Date: 01/28/99


      Both of the simple example classes below, work perfectly
      in JDK1.0 but fail to work correctly in JDK1.16

      In ExecDemo1, I simply attempt to invoke the DOS
      editor edit, with a file called foo.
      Under JDK1.0 this works perfectly!
      Under JDK1.16 the program ends without ever having
      started edit.com


      class ExecDemo1 {
         public static void main (String args[]) throws Exception {
            Runtime.getRuntime().exec("edit.com foo");
         }
      }

      /***********************************************/

      In ExecDemo2, I invoke a directory listing via the
      internal command dir. I then echo to the console the
      captured dir output, via getInputStream().
      Again, under JDK1.0 this works perfectly!
      But, under JDK1.16, while the dir output is indeed
      displayed on the console, it seems to encounter some
      sort of end-of-file problem, because the program just
      hangs, failing to ever print the final "Job has finished"
      message. In order to exit the program I have to press
      control c.

      import java.io.*;
      class ExecDemo2 {
         public static void main (String args[]) throws Exception {
            Process p = Runtime.getRuntime().exec("command.com /c dir");
            InputStream in = p.getInputStream();
            int c;
            while ((c=in.read()) != -1) System.out.print ((char)c);
            System.out.println("Job has finished");
         }
      }
      (Review ID: 33133)
      ======================================================================

      Attachments

        Activity

          People

            Unassigned Unassigned
            dblairsunw Dave Blair (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: