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 38 39 40 41 42 43 44 45
|
// On execute l'outil
Runtime runtime = Runtime.getRuntime();
final Process process = runtime.exec(new String[] { "mfold_outputXML_2.pl", "T", temp, "Na", na, "Mg", mg, "-seqfile", "seqs.fasta"} );
try{
int fin = process.waitFor();
System.out.println("apres wait : "+fin);
System.out.println("La valeur de sortie de l'executione est:"+process.exitValue());
}
catch(InterruptedException ie){
ie.printStackTrace();
System.out.println("InterruptedException : Application interrompu par le System");
}
catch(IllegalThreadStateException itse){
itse.printStackTrace();
System.out.println("IllegalThreadStateException : Application interrompu par le System");
}
new Thread() {
public void run() {
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line = "";
try {
while((line = reader.readLine()) != null) {
// Traitement du flux de sortie de l'application si besoin est
sortie = sortie.concat(line);
}
} finally {
reader.close();
}
} catch(IOException ioe) {
ioe.printStackTrace();
System.out.println("IOExc : Application interrompu par le System");
}
}
}.start();
System.out.println("Finsortie : "+sortie+"\n"); |
Partager