getting command line output from mps

i have used to following code to run a jar file from and mps intention. My question is, how can I get the output stream in mps?

 

Runtimeruntime=Runtime.getRuntime();
stringcommandString="cmd /c java -jar gxw.jar "+filename+" --output=pseudocode";
Processp=runtime.exec(commandString);

2 comments

Hey!

I don't know if that's exactly what you'd like to do. I used the Java Process API via command line. See the following code.

// start tool.exe
ProcessBuilder builder=new ProcessBuilder("C:\tool.exe","-arg","arg");
Process process=builder.start();
// get the console output - tool.exe
BufferedReader reader=new BufferedReader(newInputStreamReader(process.getInputStream()));
string line;
StringBuilder stringBuilder=new StringBuilder();
while((line=reader.readLine())!=null){
  stringBuilder.append(line);
}
string errorMsg=stringBuilder.toString();

Regards m sch95

0

Please sign in to leave a comment.