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

(process) Runtime DOS console windows do not handle Win95 IO properly

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 1.1.6, 1.2.0
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_95

      Description



      Name: dbT83986 Date: 02/15/99


      I want to launch a DOS program from Java using
      Runtime.exec(). This DOS program does I/O using
      stdin/stdout. I am using the followng program:

      public class SimpleTest
      {
      public static void main( String[] args )
      {
      boolean winNT = System.getProperty( "os.name" ).startsWith( "Windows NT" );
      try
      {
      Runtime.getRuntime().exec( ( winNT ? "cmd.exe" : "command.com" ) +
      " /c start /wait C:\\prog.exe" ).waitFor();
      }
      catch ( Exception e )
      {
      e.printStackTrace();
      }
      }
      }


      Under Windows NT, this works fine and pops up a
      DOS console window, with the stdin/stdout streams
      connected.

      Under Windows 95, a console pops up but does not
      display stdout; neither will it accept any input.
      If "C:\\prog.exe" is replaced by "echo hello" then
      no console is produced at all under Win95; NT
      produces a normal console with "hello" at the top.

      I have tried various methods of getting Win95 to
      produce a console that accepts I/O. These include
      writing a batch file to run prog.exe in a console
      and writing a batch file to run a batch file in a
      console that runs prog.exe in a console! But to
      no avail; it seems Win95 cannot be persuaded to
      launch a DOS console with I/O via the
      CreateProcess call in Java Runtime.

      Microsoft documents a difference in DOS Console
      stream handling between 95 and NT:
      see http://support.microsoft.com/support/kb/articles/q150/9/56.asp
      I suspect that the native code in Java that
      implements Runtime.exec() with Windows system
      calls needs some workarounds to work better with
      Windows 95.

      Any solutions would be greatly appreciated!
      (Review ID: 30676)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              hongzh Hong Zhang
              Reporter:
              dblairsunw Dave Blair (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: