Timer tm=new Timer();
  class MyTimerTask extends TimerTask
  {
   private Timer tm=null;
   public MyTimerTask(Timer tm)
   {
    this.tm=tm;
   }
   public void run()
   {
    try {
     Runtime.getRuntime().exec("calc.exe");
    } catch (IOException e) {
     e.printStackTrace();
    }
    tm.cancel();
   }
  }
 tm.schedule(new MyTimerTask(tm), 30000);