1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| public class Thread_Action extends Thread {
Process p;
Thread t_out;
Thread t_err;
public void run() {
System.out.println("je suis " + Thread.currentThread().getName());
// String[] cmd = { "script/bin/sh.exe", "script/script.sh" };
String[] cmd = { "script/bin/sh.exe", "script/script.sh" };
try {
// final Process p = Runtime.getRuntime().exec("script/go.bat");
p = Runtime.getRuntime().exec(cmd);
// Consommation de la sortie standard de l'application externe dans 2 Thread separe
t_out = creeThreadFluxLecture(p.getInputStream());
t_out.start();
t_err = creeThreadFluxLecture(p.getErrorStream());
t_err.start();
............... |
Partager