Thursday, June 12, 2008

Java - Passing string with spaces to exec

While using Runtime.getRuntime().exec in Java

To pass the string with spaces in the argument we need to use exec(String[]) method instead of exec(String)

Both of the above command execute the specified command and arguments in a separate process.

If we will use exec(String) then this will not take string with spaces.

No comments: