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

Newsgroups comp.lang.java.programmer
Date 2014-03-12 13:10 -0700
References <8f4aa46a-16f4-4b36-a951-7e8eda1692db@googlegroups.com>
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>

Show all headers | 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