JDK-4485848 : Runtime.exec of 1.4.0 beta73 does not work on WindowsNT/2000
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 1.4.0
  • Priority: P1
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_nt
  • CPU: x86
  • Submitted: 2001-07-30
  • Updated: 2001-07-30
  • Resolved: 2001-07-30
Related Reports
Duplicate :  
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 73. On Unix systems the functionality is O.K. in all JDK versions.

When I have following String:
execStr = cmd /X /C "cd /D \"c:\Program Files\""
Runtime.getDefault().exec(execStr) gives following exception:
java.lang.IllegalArgumentException: "cd: unmatched quotes.
        at java.lang.Win32Process.<init>(Win32Process.java:57)
        at java.lang.Runtime.execInternal(Native Method)
        at java.lang.Runtime.exec(Runtime.java:551)
        at java.lang.Runtime.exec(Runtime.java:418)
        at java.lang.Runtime.exec(Runtime.java:361)
        at java.lang.Runtime.exec(Runtime.java:325)
        at TestExec.main(TestExec.java:32)

When I parse the String into the String[] array in the following way:
cmd
/X
/C
cd /D \"c:\Program Files\"

and call: Runtime.getDefault().exec(execArr), 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.



Comments
EVALUATION Duplicate of 4479699, which has already been fixed and integrated into the latest build.
11-06-2004

PUBLIC COMMENTS Duplicate of 4479699, which has already been fixed and integrated into the latest build.
10-06-2004