private void jgobuttonActionPerformed(java.awt.event.ActionEvent evt) { // command we want to run String cmd = jcommandlabel.getText(); class DontEverDoThis implements Runnable { private final String cmd; DontEverDoThis(final String cmd) { this.cmd = cmd; } @Override public void run() { try { Process p = Runtime.getRuntime().exec(cmd); int i; InputStream in = p.getInputStream(); while((i = in.read()) != -1) { System.err.print(i); } } catch(Exception E) { E.printStackTrace(); } } } Thread nt = new Thread(new DontEverDoThis(cmd)); nt.start();