I am currently looking for ways that I could actually print information to the jTextpane when I run the following code. When I press the button to run it, the program actually hang and no display for the output. Is there anyway to go round it or to fix it?
private void ScannetworkActionPerformed(java.awt.event.ActionEvent evt) {
Process p = null;
try {
p = Runtime.getRuntime().exec("ipconfig /all");
} catch (IOException ex) {
Logger.getLogger(home.class.getName()).log(Level.SEVERE, null, ex);
}
try {
p.waitFor();
} catch (InterruptedException ex) {
Logger.getLogger(home.class.getName()).log(Level.SEVERE, null, ex);
}
BufferedReader buf = new BufferedReader(new InputStreamReader(
p.getInputStream()));
String line = "";
String output = "";
try {
while ((line = buf.readLine()) != null) {
output += line + "\n";
} } catch (IOException ex) {
Logger.getLogger(home.class.getName()).log(Level.SEVERE, null, ex);
}
nninfo.setText(output);