title: Scheduler task in java
body: <p>This is my scheduled timer program . it is deployed in tomcat. 
  I want this to be run everyday at 11:46 AM.</p>
  
  <p>so, if deploy that it tomcat, automcatically will it kick off at 11:46AM?</p>
  
  <p>Please advise.</p>
  
  <pre><code>public class TimeScheduler {
      Timer timer;
      Date time = new Date();
  
  
      public TimeScheduler() {
          timer = new Timer();
          taskExecutionTime();
          timer.schedule(new RemindTask(), time);
      }
  
      public Date taskExecutionTime()
      {
          Calendar cal = Calendar.getInstance();
          cal.set(Calendar.HOUR_OF_DAY, 9);
          cal.set(Calendar.MINUTE, 46);
          cal.set(Calendar.SECOND, 0);
  
          time = cal.getTime();
          return time;
      }
  
  
      class RemindTask extends TimerTask {
          public void run() {
              System.out.format("Task is Running now!");
              try {
                  CSVReader.parseCSV();
              } catch (FileNotFoundException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              } catch (IOException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              } catch (Exception e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
              timer.cancel(); //Terminate the timer thread
              System.out.format("Task is Complete!");
         }
     }
  
     public static void main(String args[]) {
         new TimeScheduler();
     }
  }
  </code></pre>