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 32 33 34 35 36 37
|
String[] args = { Parametrage.getInstance().getExecutable(), "-c",Parametrage.getInstance().getCheminResultatsIntermediaires() + "/profil.temp",Parametrage.getInstance().getCheminResultatsIntermediaires() + "/my.cfg" };
ProcessBuilder pb = new ProcessBuilder(args);
Process p = pb.start();
InputStream is = p.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
InputStream errSt=p.getErrorStream();
InputStreamReader isErr = new InputStreamReader(errSt);
BufferedReader br = new BufferedReader(isr);
BufferedReader brErr = new BufferedReader(isErr);
String ligne;
System.out.println("--------------Debut calcul profil--------------");
ligne=br.readLine();
while (ligne != null) {
System.out.println(ligne);
ligne=br.readLine();
}
p.waitFor();
ligne=br.readLine();
while (ligne != null) {
System.out.println(ligne);
ligne=br.readLine();
}
System.out.println("--------------Fin calcul profil----------------");
ligne=brErr.readLine();
while (ligne != null) {
System.out.println("ERREUR ("+ligne+")");
ligne=br.readLine();
}
int res = p.exitValue();
System.out.println(res);
if (res == 0)
afficherDernierProfil();
else {
JOptionPane.showMessageDialog(ModuleProfilFrame.this, Localisation.getText("ModuleProfil.ErreurCalcul"),
Localisation.getText("ModuleProfil.Erreur"), JOptionPane.ERROR_MESSAGE);
} |
Partager