When i run this script manually then Browser chrome open the site in one tab (which is PERFECT exactly how i needed)
But when i run the same script using Java sample code 10 times, it open Browser but 10 times same page 10 TABs.
Q. How can i tell Java code please run it as it was suppose to be running manual execution (so that i have 1 TAB only?) ?
BASH: /var/tmp/runme.sh (ran 1o times and still have always 1 tab as expected)
export DISPLAY=:0.0
ps aux | grep chromium-browser | awk '{ print $2 }' | xargs kill -9;
sleep 8;
chromium-browser --process-per-site --no-discard-tabs --ash-disable-tab-scrubbing -disable-translate "http://www.oracle.com" &
Java: launch 10 times that script
system("/var/tmp/runme.sh &");
public static String system(String cmds) {
String value = "";
try {
String cmd[] = { "/bin/sh", "-c", cmds};
Process p = Runtime.getRuntime().exec(cmd);
p.waitFor();
BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = reader.readLine();
while (line != null) {
value += line + "\n\r";
line = reader.readLine();
}
}
catch (IOException ioe) {
ioe.printStackTrace();
}
catch (InterruptedException ie) {
ie.printStackTrace();
}
return value;
}