Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #27744

Re: a question about using ProcessBuilder to call external command

X-Received by 10.50.115.4 with SMTP id jk4mr148332igb.1.1394655061240; Wed, 12 Mar 2014 13:11:01 -0700 (PDT)
X-Received by 10.182.130.169 with SMTP id of9mr77007obb.26.1394655061083; Wed, 12 Mar 2014 13:11:01 -0700 (PDT)
Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!peer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!ur14no6393500igb.0!news-out.google.com!gi6ni105igc.0!nntp.google.com!l13no5734396iga.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.java.programmer
Date Wed, 12 Mar 2014 13:10:58 -0700 (PDT)
In-Reply-To <8f4aa46a-16f4-4b36-a951-7e8eda1692db@googlegroups.com>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=205.156.36.56; posting-account=oo44OQoAAABMDvaRlaO3SeQ5MVbxqLdH
NNTP-Posting-Host 205.156.36.56
References <8f4aa46a-16f4-4b36-a951-7e8eda1692db@googlegroups.com>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <3ac9c98d-5ac9-4bf6-a28f-151ff91c08de@googlegroups.com> (permalink)
Subject Re: a question about using ProcessBuilder to call external command
From zyng <xsli2@yahoo.com>
Injection-Date Wed, 12 Mar 2014 20:11:01 +0000
Content-Type text/plain; charset=ISO-8859-1
X-Received-Bytes 1712
X-Received-Body-CRC 3651521244
Xref csiph.com comp.lang.java.programmer:27744

Show key headers only | View raw


Following that, I have another question on different perspective. My code:
final ProcessBuilder processBuilder = new ProcessBuilder(new String[]{"/bin/sh", "-c", the_command_and_arguments});

final Process processRunSysCmd = processBuilder.start();//start a new process -- a child process

runs fine on Linux, but when on Cygwin(on Microsoft Windows), it fails due to "/bin/sh" issue. On the terminal of Cygwin, the command:
/bin/sh -c "the command and arguments"

works fine. But if calling from Java program, it is not ok. I am puzzled.

Thank you again.

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

a question about using ProcessBuilder to call external command zyng <xsli2@yahoo.com> - 2014-03-12 13:06 -0700
  Re: a question about using ProcessBuilder to call external command zyng <xsli2@yahoo.com> - 2014-03-12 13:10 -0700
    Re: a question about using ProcessBuilder to call external command Roedy Green <see_website@mindprod.com.invalid> - 2014-03-17 03:02 -0700
  Re: a question about using ProcessBuilder to call external command Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-03-12 16:36 -0400
  Re: a question about using ProcessBuilder to call external command Roedy Green <see_website@mindprod.com.invalid> - 2014-03-16 01:03 -0700

csiph-web