Passer des paramètres à une application externe
Bonjour,
Voilà je cherche à lancer un programme externe, et à lui passer des paramètres.
J'arrive à le lancer, mais j'ignore comment on inter-agit.
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
|
public void StartCommand(String command) {
try {
//creation du processus
Process p = Runtime.getRuntime().exec(command);
InputStream in = p.getInputStream();
//on récupère le flux de sortie du programme
StringBuilder build = new StringBuilder();
char c = (char) in.read();
while (c != (char) -1) {
build.append(c);
c = (char) in.read();
}
String response = build.toString();
//on l'affiche
System.out.println(response);
}
catch (Exception e) {
System.out.println("\n" + command + ": commande inconnu ");
}
} |
Je lance un programme en .NET. Il y a trois champs à remplir, puis un bouton valider.
Si quelqu'un a déjà fait, ou pourrait m'aiguiller.
Merci.