Write system call results to a text box
I am making a DOS system call that creates a file. Once this file is created it gives me a "packet created successfully" message that is written to the screen.
I am using Netbeans 5.5.1 and Swing. and I want this message to be output into a JtextArea. The system call works fine and the file is created, I just can't get the message to write to my text area.
Below is a sample of my code:
privatevoid btn_importActionPerformed(java.awt.event.ActionEvent evt){
// TODO add your handling code here:
String Rep = txt_Repname.getText();
String Work = txt_Workdir2.getText();
String VOB = txt_VOBtag.getText();
String VOBstorage = txt_VOBName2.getText();
String Replicapath = txt_Replicapath.getText();
String command = ("cmd /c multitool mkreplica -import -npreserve -nc -vreplica " + Rep +" -work " + Work +" -tag \\" + VOB + " -vob" + VOBstorage + "" + Replicapath);
StringBuffer sb =new StringBuffer();
Process p =null;
try{
p = Runtime.getRuntime().exec(command);
}catch (IOException ex){
ex.printStackTrace();
}
Scanner s =new Scanner(p.getInputStream());
while(s.hasNextLine()){
sb.append(s.nextLine()+"\n");
}
String result = sb.toString();
txt_Importresults.setText(result);
}

