Ciao se ho capito bene non è difficile il tuo problema ... Dimmi se ti basta questo codice per capire oppure devo spiegartelo o scriverne altro...
codice:
import java.io.*;
public class Main {
public static void main(String args[]) {
try {
Runtime rt = Runtime.getRuntime();
//Process pr = rt.exec("cmd /c dir");
Process pr = rt.exec("c:\\helloworld.exe");
BufferedReader input = new BufferedReader(new InputStreamReader(pr.getInputStream()));
String line=null;
while((line=input.readLine()) != null) {
System.out.println(line);
}
int exitVal = pr.waitFor();
System.out.println("Exited with error code "+exitVal);
} catch(Exception e) {
System.out.println(e.toString());
e.printStackTrace();
}
}
}
Dai ti aiuto un pò di più:
codice:
process = Runtime.getRuntime().exec("cmd.exe /C qui l'eseguibile.exe e qui argomenti");
ES:
codice:
process = Runtime.getRuntime().exec("cmd.exe /C mytest.exe Prova.txt");