JDK-4491217 : Runtime.exec of 1.4.0 beta75 does not work on WindowsNT/2000
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 1.4.0
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_98,windows_nt,windows_2000
  • CPU: x86
  • Submitted: 2001-08-13
  • Updated: 2001-09-14
  • Resolved: 2001-09-14
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.4.0 beta3Fixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Description
Runtime.exec() produces errors on WindowsNT/2000. The same arguments, that works correctly in JDK 1.3.1 do not work in JDK 1.4.0 beta 75. On Unix systems the functionality is O.K. in all JDK versions.

When I have following String[] array
array[0]=cmd
array[1]=/X
array[2]=/C
array[3]=cd /D "C:\WINNT\Profiles\mentlicher\Application Data\CVS_WORK\."&&  "cvs" -d ":local:C:\WINNT\Profiles\mentlicher\Application Data\CVS_REP"  status  "Package\LocaleChange.java"

and call: Runtime.getDefault().exec(array), the command executes, but I get following error on the error output:

The name specified is not recognized as an
internal or external command, operable program or batch file.

This makes the VCS integration module of Forte 4 Java unusable on JDK 1.4.0

I've filled a similar bug for this (#4485848), it was marked as a duplicate of a bug, that did not fix this problem. So please fix it and do not mark it as a duplicate.

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: merlin-beta2 merlin-beta3 FIXED IN: merlin-beta2 merlin-beta3 INTEGRATED IN: merlin-beta3
14-06-2004

EVALUATION In Runtime.exec(String[]) each argument should be put into a separate slot in arguments array. For the example of 4485848 execStr = cmd /X /C cd /D "c:\Program Files\" one should have a[0] = "cmd"; a[1] = "/X"; a[2] = "/C"; a[3] = "cd"; a[4] = "/D"; a[5] = "C:\\Program Files\\" or "\"C:\\Program Files\\\"" In the past we would allow another combination, which the submitter of this bug uses. We have fixed some other bugs, related to spaces in command line arguments. As a side effect, this old combination is now not allowed. It is unfortunate, but reverting back would reincarnate some other bugs related to spaces in command line parameters. To summarize, the only safe way is to put each argument into a separate slot in arguments array.
11-06-2004

WORK AROUND In bash use single quote instead of a double quote. a[0] = "bash"; a[1] = "-c"; a[2] = "\"cd '/Program Files'; pwd\""; ###@###.### 2001-08-14 [###@###.### 2001-08-15]: This is just a useless workaround for me, because it will not work with files with a single quote in their names. It's not possible to escape a single quote inside single quotes.
11-06-2004

PUBLIC COMMENTS Fixed.
10-06-2004