你可以写个线程,运行完以后sleep一定时间,然后再运行。就是一个死循环。
或者你可以在Windows里面配置任务。linux下也应该有相应的配置。

解决方案 »

  1.   

    Thread.sleep(要休眠的毫秒)...前面加个循环就可以了
      

  2.   

    实现的方法有两种不过都是继承于线程类来实现的。1。
     public void run() {
        while (true) {
          try {
            sleep(10000L);  //间隔10s执行一次!
          }
          catch (Exception ex) {
            ToolBox.getLogger().error("Executing the sleep operation error!");
            ex.printStackTrace();
          }
    2。采用timer类和timertask类配合实现
    在timertask里面有一个时间间隔执行任务的方法schedule的方法可以达到你的要求!
          OperationExecute();
        }
      }    
      

  3.   

    实现的方法有两种不过都是继承于线程类来实现的。1。
     public void run() {
        while (true) {
          try {
            sleep(10000L);  //间隔10s执行一次!
          }
          catch (Exception ex) {
            ToolBox.getLogger().error("Executing the sleep operation error!");
            ex.printStackTrace();
          }
          OperationExecute();//你的操作
        }
      }    2。采用Timer 类和TimerTask 类配合实现
    在Timer 里面有一个时间间隔执行任务的方法schedule的方法可以达到你的要求!Timer tim = new Timer();
    TimerTask tTask = new TimerTask(); //在里面实现你的操作
    tim.schedule(tTask,0,10000);//间隔时间10000你自己设定
      

  4.   

    同意楼上的,TimerTask就是干这个的.
      

  5.   

    public class YourTask extends TimerTask {
      public void run(){
        //每个一段时间你想要做的事
      }
    }Timer timer = new Timer();
    YourTask task = new YourTask();
    timer.scheduleAtFixedRate(task,开始时间,周期);//开始时间Date型,周期long型豪秒级