> Hello
>
> Can we execute a unix command using java?
Yes
>If it is
> how we can execute.
Runtime.getRuntime().exec("ls -a");
>Is this affect the performance of
> the program.
>
>
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
>
> Thanks
You are welcome
I tried what you said. But its not working and returning error message,
java.io.IOException: CreateProcess: ls -a error=2
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
at java.lang.ProcessBuilder.start(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
If i try this statement,
Runtime.getRuntime().exec("c\windows\notepad");
It is working fine.
Any idea about this.
Plz ...........