2 things

Bryce McKinlay bryce@albatross.co.nz
Mon Aug 2 17:07:00 GMT 1999


Simon Gornall wrote:

> Also, here's a (very poor!) patch for Runtime.exec() which takes into
> account a single level of quoting in a passed-in execution string. So
> you can call exec("find /tmp -name xxx -printf '%p %AH'") for example.

This is not neccessary. The right way to go in Java would be something like:

String[] pargs = {"find","/tmp","-name","xxx","-printf","%p %AH"};
Process p = Runtime.getRuntime().exec(pargs);

The JDK does not observe quotes or other shell substitutions, other than being
able to find an executable on your PATH. gcj's implementation is pretty close to
this. Starting a shell to handle every exec() call would add extra overhead that
we don't allways need/want.

  [ bryce ]




More information about the Java mailing list