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


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

Re: problem with multiword args and Runtime.exec()

From Martin Gregorie <martin@address-in-sig.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: problem with multiword args and Runtime.exec()
Date 2013-01-11 21:36 +0000
Organization UK Free Software Network
Message-ID <kcq0k3$o1c$1@localhost.localdomain> (permalink)
References <05a24a02-1ac3-4866-ba2b-20c488793b96@googlegroups.com>

Show all headers | View raw


On Fri, 11 Jan 2013 08:33:39 -0800, Aryeh M. Friedman wrote:

> No matter what version of Runtime.exec I call I can not make a arg that
> has multiple words in it (*NOT* multiple args but a single one) for
> example if I need to issue the following command in unix I can not find
> a way to do the stuff in "'s as a single arg [the called program
> requires this... i.e. it *MUST NOT* be treated as different elements of
> String[] args if it was a java program]):
> 
> rdiff-backup --remote-schema "ssh -C -p9222 %s rdiff-backup --server"
> username@remoteserver::/path_to/filestobackup /path_to/backedupfiles

Something like 

Runtime r = new Runtime();
String  sc = String.format("ssh -C -p9222 %s rdiff-backup -- server",
                           hostName);
r.exec("rdiff-backup",
       "--remote-schema",
       sc,
       "username@remoteserver::/path_to/filestobackup " +
       "/path_to/backedupfiles");

ought to work.


-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

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


Thread

problem with multiword args and Runtime.exec() "Aryeh M. Friedman" <Aryeh.Friedman@gmail.com> - 2013-01-11 08:33 -0800
  Re: problem with multiword args and Runtime.exec() Lew <lewbloch@gmail.com> - 2013-01-11 11:07 -0800
  Re: problem with multiword args and Runtime.exec() FredK <fred.l.kleinschmidt@gmail.com> - 2013-01-11 11:41 -0800
    Re: problem with multiword args and Runtime.exec() FredK <fred.l.kleinschmidt@gmail.com> - 2013-01-11 11:44 -0800
  Re: problem with multiword args and Runtime.exec() "A. Bolmarcich" <aggedor@earl-grey.cloud9.net> - 2013-01-11 15:27 -0600
  Re: problem with multiword args and Runtime.exec() Martin Gregorie <martin@address-in-sig.invalid> - 2013-01-11 21:36 +0000

csiph-web