JDK-4499932 : REGRESSION: exec fails on Windows platform on paths containing spaces
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 1.4.0
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2001-09-05
  • Updated: 2001-09-05
  • Resolved: 2001-09-05
Related Reports
Duplicate :  
Description

Name: yyT116575			Date: 09/05/2001


java version "1.4.0-beta2"
Java<TM> 2 Runtime Environment, Standard Edition <build 1.4.0-beta2-b77>
Java HotSpot<TM> Client VM <build 1.4.0-beta2-b77, mixed mode>

// there is a bug in 1.4.0-beta2 on the Windows platform.
// It involves creating processes whose path name contains
// .embedded spaces.  To demonstrate, create a folder
// "c:\test folder" and put a copy of notepad.exe in it.
// The following program runs successfully on 1.3.1 and also
// on 1.4.0-beta, but throws an IOexception error=123 on beta2.

import java.io.File;

public class Bug {
  static public void main (String args[]) {
    String[] cmd = new String[2];
    cmd[0] = "c:\\test folder\\notepad.exe";
    cmd[1] = "Bug.java";
    File f = new File(cmd[0]);
    System.err.println(cmd[0] + " length is " + f.length());
    try {
      Runtime.getRuntime().exec(cmd);
      Thread.sleep(10*1000);
    } catch (Exception e) {
      e.printStackTrace();
    }
    System.err.println("exitting");
  }
}

C:\test folder>java Bug
c:\test folder\notepad.exe length is 50960
java.io.IOException: CreateProcess: c:\test" "folder\notepad.exe Bug.java
error=123
        at java.lang.Win32Process.create(Native Method)
        at java.lang.Win32Process.<init>(Win32Process.java:72)
        at java.lang.Runtime.execInternal(Native Method)
        at java.lang.Runtime.exec(Runtime.java:551)
        at java.lang.Runtime.exec(Runtime.java:477)
        at java.lang.Runtime.exec(Runtime.java:443)
        at Bug.main(Bug.java:18)
exitting
(Review ID: 131417) 
======================================================================

Comments
PUBLIC COMMENTS Duplicate of 4491217, now fixed
10-06-2004