Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!border3.nntp.ams.giganews.com!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!nntp.bt.com!news.bt.com.POSTED!not-for-mail NNTP-Posting-Date: Sun, 21 Apr 2013 08:33:34 -0500 From: "Chris Uppal" Newsgroups: comp.lang.java.programmer References: Subject: Re: exec problem is JDK 1.7.0_21 Date: Sun, 21 Apr 2013 14:30:42 +0100 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5512 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512 X-RFC2646: Format=Flowed; Original Message-ID: Lines: 45 X-Usenet-Provider: http://www.giganews.com X-AuthenticatedUsername: NoAuthUser X-Trace: sv3-ALe3BmivuWTyzC30DByjFrqvAE6Xh1eEo87OCRGfckFcsgKSeQVhWHhI7Dg8eKArGfUBbkUrTyldMSD!nquPzpqq8Hoz1czu10eDz6GjswAd950iJbkmd2Nu4PNLSayir7kNg+tcC094QEX4IZ/nviPrreE= X-Complaints-To: abuse@btinternet.com X-DMCA-Complaints-To: abuse@btinternet.com X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 3234 Xref: csiph.com comp.lang.java.programmer:23550 Sven Köhler wrote: > The documentation speaks of "operating systems where programs are > expected to tokenize command line strings themselves". Windows is that > type of operating systems. Agreed. At least at the Win32 API level (the lowest level that normal mortals get to use). As noted elsethread some compilers/libraries for C and C++ on Windows do the argument parsing for you, but that's just a convenience hack in libc -- and only applies to command-line programs anyway. > For that type of operating system, the list > of strings shall contain exactly two elements. The documentation doesn't say that on such systems the list MUST contain exactly two elements, it states (my emphasis): "on such a system a Java implementation MIGHT require commands to contain exactly two elements" Or, to put it another way: the only way to find out what works is to experiment (it probably depends on the application you're launching as well as the OS and Java platform). A right pain in the bum... > Source: > http://docs.oracle.com/javase/7/docs/api/java/lang/ProcessBuilder.html > And in fact, I can confirm that ProcessBuilder passes the second element > of the string list to the invoked external program - however only if the > argument starts and ends with a quote. Nothing like experiment :-) But two questions: what version of windows were you using ? And what kind of external application were you testing it with ? For the last question I mean was it a C/C++ program compiled for the command-line, a Win32 GUI program writing to the MS-supplied C/C++ libraries, a .NET program, a Delphi (or some other language) program, a Java program, a Cygwin executable ??. All of these might -- and I suspect often do -- have different rules... -- chris