ho scritto qualcosa del genere
codice:
{
  jButton1 = new JButton();
  this.add(jButton1);
  mess1=new JLabel();
  this.add(mess1);
  jButton1.setText("OK");
  jButton1.addActionListener(new ActionListener() {
 public void actionPerformed(ActionEvent evt) {
    try{

        Runnable processexecute = new Runnable() {
	   public void run() {
	      try  {   
		Process p1 = Runtime.getRuntime().exec("programma "+namedataset); 
                mess1.setText("Wait...");
	        InputStreamReader isr = new InputStreamReader(p1.getInputStream());
	        BufferedReader br = new BufferedReader(isr);
		if((line=br.readLine())!=null){
		    mess1.setText(line);
		            	}
	            } catch (IOException ioe)
			  {
			      ioe.printStackTrace();
			         		              }		            
			            	     }
			            	 };
          SwingUtilities.invokeLater(processexecute);
           Process p2 = Runtime.getRuntime().exec("programma2 "+mess1.getText());
	} catch (Exception e) {
	e.printStackTrace();}
				        }
				});
			}
}
}
anche se il tutto funziona ho il solito blocco