[Système][Runtime]lancer une application externe
Bonjour,
J'ai un pb que je ne comprends pas avec ce code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| public void run() {
System.out.println("Simmetrix starts running");
String [] Cmd={"/disk3/home/mencaglia/develop/cfd-mp/meshParasol/meshParasol-current","-s", "/disk3/home/mencaglia/jbproject/Solver/cas2.msf" };
for (int i=0; i<3; i++)
System.out.println(Cmd[i]);
try {
Runtime r = Runtime.getRuntime();
r.traceInstructions(true);
Process proc = r.exec(Cmd);
int test = proc.exitValue();
int status = proc.waitFor();
System.out.println(test);
System.out.println(status);
}
catch (IOException e) {
System.out.println("erreur d'execution " + Cmd + e.toString());
}
catch (InterruptedException e) {
System.out.println("interruption " + Cmd + e.toString());
}
catch (IllegalThreadStateException e)
{
System.out.println("interruption 2" + Cmd + e.toString());
e.printStackTrace();
}
System.out.println("End of run");
} |
et je reçois ce message aprés éxécution:
interruption2 [Ljava.lang.String;@17590dbjava.lang.IllegalThreadStateException: process hasn't exited
meshParasol-current est un mailleur, je tape dans le shell habituellement pour mailler une pièce meshParasol -s cas2.msf car j'ai déf un alias.
La je mets le chemin complet et apparemment il trouve cette exe mais je comprends pas pourquoi le process ne se termine pas!
Merci,
Xavier
Si qqn peut m'aider