After running one executable file from my gui application using swing in java, i want to display running commentary of cmd in my textarea which i have taken on my gui applcation in lower half portion .How can i do it . This is my code i have written for my Run button for running .exe file:-
private void runActionPerformed(java.awt.event.ActionEvent evt) {
System.out.println( "Running" );
try
{
String [] command = { "cmd.exe", "/c", "start",
"runMatness.bat",
"inputfile=" + myFilePath,
"dbreporting=false" };
Process myProcess = Runtime.getRuntime().exec(command);
BufferedReader input =
new BufferedReader (new InputStreamReader(myProcess.getInputStream()));
while ((line = input.readLine()) != null)
{
displayresult.append(line);
}//while
input.close();
}// eof try
catch (Exception err)
{
err.printStackTrace();
}//eof catch
where displayresult is my textarea.