I want to run the system commands with java in Linux environment.
For example:
" tar -cvf test.tar ./test/* "
"su"
"cp src.txt tgt.txt "
etc.
Runtime.getRuntime().exec("tar -cvf test.tar ./test/*");
BartCr - 14 Dec 2005 05:45 GMT
If you plan on using Java 5 (1.5), take a look at
java.lang.ProcessBuilder.
Bart
Autumn-Fox - 14 Dec 2005 16:27 GMT
Thank you guys very much.
>I want to run the system commands with java in Linux environment.
>For example:
[quoted text clipped - 3 lines]
>
>"cp src.txt tgt.txt "
see http://mindprod.com/jgloss/exec.html

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
ricky.clarkson@gmail.com - 14 Dec 2005 01:46 GMT
Also see http://javafaq.mine.nu/lookup?110
Tim Terry - 14 Dec 2005 22:24 GMT
> Also see http://javafaq.mine.nu/lookup?110
You might have trouble if you need to enter a password for the 'su'
command, due to io streams from the process and the jvm. being vague as
can't really remember the specifics from a previous project.
Tim