How to execute command in Java with parameters?
Process p = Runtime.getRuntime().exec(new String[]{"php","/var/www/script.php -m 2"});
Does'n work.
String[] options = new String[]{"option1", "option2"};
Runtime.getRuntime().exec("command", options);
Does'n work also, because it doesn't specify the "m" parameter.
Use
ProcessBuilder
instead ofRuntime#exec()
.The following should work fine.
See if this works (sorry can't test it right now)