Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder2.hal-mli.net!feeder.erje.net!eu.feeder.erje.net!fu-berlin.de!uni-berlin.de!news.dfncis.de!not-for-mail From: =?ISO-8859-1?Q?Sven_K=F6hler?= Newsgroups: comp.lang.java.programmer Subject: Re: exec problem is JDK 1.7.0_21 Date: Sun, 21 Apr 2013 00:40:59 +0300 Lines: 27 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: news.dfncis.de GeFMA3BgW/NGwfTqhfebOQqF6oHrNiuClYDOcIfhW8M5ZSTaCxGPtVRodU Cancel-Lock: sha1:Gv8Tzb7ioRJNmUkMc/MDL8F66VI= User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 In-Reply-To: Xref: csiph.com comp.lang.java.programmer:23541 Am 20.04.2013 23:03, schrieb Joerg Meier: > ProcessBuilder acts exactly the way Windows needs it to: Oh, and of course the ProcessBuilder doesn't behave as it is supposed to. As mentioned in my first post, the String "\"a b\"" would be passed unmodified to the program invoked. However, clearly, the string passed to the program should have been "\"\\\"a b\\\"\"" Only with the quotes and backslashes added, CommandLineToArgv would decode it to "\"a b\"". With the current ProcessBuilder implementation, a Windows program will see the parameter "a b" while on UNIX the program will see "\"a b\"". See http://msdn.microsoft.com/en-us/library/windows/desktop/bb776391%28v=vs.85%29.aspx for details. Note, that I assume that the program invoked uses CommandLineToArgv to decode the command line. Which is by no means clear, as any program can implement their own tokenizer. Don't you find that a bit strange? Regards, Sven