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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.1.6, 1.2.0
    • core-libs
    • x86
    • windows_95



      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)
      ======================================================================

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: