I am trying to run a bash script on my Ubuntu machine through Java. The bash script takes 2 input as parameters that i am passing as an array However, it does not seem to be passing the value of array[0] and array[1] to the bash script?
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import org.omg.CORBA.portable.InputStream;
public class readBashScript {
public static void readBashScript() {
try {
String[] array = {"ys1","R"};
Process proc = Runtime.getRuntime().exec("var/www/red/marsh_webreset.sh /",array);
BufferedReader read = new BufferedReader(new InputStreamReader(
proc.getInputStream()));
try {
proc.waitFor();
} catch (InterruptedException e) {
System.out.println(e.getMessage());
}
while (read.ready()) {
System.out.println(read.readLine());
}
} catch (IOException e) {
System.out.println(e.getMessage());
}
}
}