I have a program that uses Swing componants to make various system calls. I am wanting to display (or trap) any errors that occur while running the command and display the error(s) in a single message box.
Here is a sample of the code for one of my system calls...
private void btn_CreatereplicaActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String Work = txt_Workdir.getText();
String Export = txt_Exportdir.getText();
String Host = txt_Hostname.getText();
String command = ("cmd /c multitool mkreplica -export -workdir " + Work + " -nc -out " + Export + " hostname:" + Host);
Process p = null;
try {
p = Runtime.getRuntime().exec(command);
} catch (IOException ex) {
ex.printStackTrace();
}
}
Curretly if the user does something wrong when running the "command" the program just sits there (unlike a cmd prompt that displays the error). How do I get an error (if any) to pop up in a message box?
Thanks