1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| public void extrait(){
String commande = "javaw -jar \"chemin/monjar.jar\" arguments";
this.lancer(commande);
}
private void lancer(String commande){
Runtime rtGenExe = Runtime.getRuntime();
try {
Process proc = rtGenExe.exec(commande, null, new File(démarrage));
this.consume(proc);
} catch (Throwable e) {}
}
private void consume(final Process proc){
// Ce close est dans un thread, selon la même technique que la FAQ
process.getOutputStream().close();
//Consommation des flux
// http://ydisanto.developpez.com/tutoriels/j2se/runtime/#LIII-B
} |
Partager