JDK-4211683 : (process) Runtime DOS console windows do not handle Win95 IO properly
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 1.1.6,1.2.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_95
  • CPU: x86
  • Submitted: 1999-02-15
  • Updated: 1999-09-10
  • Resolved: 1999-09-10
Related Reports
Duplicate :  
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)
======================================================================

Comments
EVALUATION This looks like the win95 problem. On general, the jdk1.2 will largely work well with DOS application. Since the DOS applications are no longer important these days, it may not be worth to fix this problem. For further information, please refer 4109888 for future Runtime.exec() improvement. ###@###.### 1999-09-09
09-09-1999