Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2008
    Posts
    24
    Rep Power
    0

    Default Timer usage in java program

    Hello everyone,
    This is my first post in this forum.

    I was trying a program using java.util.Timer.
    I have scheduled a task to happen once a day, but I want to know whether this program needs to be compiled and run everyday??? :rolleyes:

    Thanks for any help in advance.

  2. #2
    roots's Avatar
    roots is offline Moderator
    Join Date
    Jan 2008
    Location
    Dallas
    Posts
    293
    Rep Power
    7

    Default

    It does not need to be compiled everyday but it needs to be run every day. You can start the program and let it run in background thereafter.

    And Welcome to the community ..
    dont worry newbie, we got you covered.

  3. #3
    Join Date
    Jan 2008
    Posts
    24
    Rep Power
    0

    Default

    Thank you, I will try it.

  4. #4
    Join Date
    Jan 2008
    Posts
    24
    Rep Power
    0

    Default

    Do you mean that I should (always)run the program when I start the computer.

  5. #5
    roots's Avatar
    roots is offline Moderator
    Join Date
    Jan 2008
    Location
    Dallas
    Posts
    293
    Rep Power
    7

    Default

    Yes and you can also use operating system's scheduler to execute your java program in given time.
    dont worry newbie, we got you covered.

  6. #6
    JAdmin is offline Member
    Join Date
    Jan 2008
    Posts
    20
    Rep Power
    0

    Default

    We are not sure, if you are using this as part of a web application. If so, there is an easy way to start the timer whenever your application server starts.

    It is usually a practice to start Servlets when the application server starts up. You can do this by setting the value for load-on-startup as 1.
    <load-on-startup>1</load-on-startup>

    Now, add code to start your thread (Timer) in the init() method of the Servlet.


    Hope this helps!
    Last edited by JavaBean; 01-24-2008 at 08:00 PM. Reason: No url at the end of every post!

Similar Threads

  1. How to determine CPU usage using Java?????
    By JavaEmpires in forum New To Java
    Replies: 5
    Last Post: 03-16-2011, 04:49 AM
  2. Replies: 0
    Last Post: 04-04-2008, 02:46 PM
  3. making a count down timer using java
    By saytri in forum New To Java
    Replies: 3
    Last Post: 12-29-2007, 09:49 PM
  4. Help with timer in java
    By barney in forum Advanced Java
    Replies: 1
    Last Post: 08-01-2007, 10:24 AM
  5. Problem with timer in java
    By paul in forum Advanced Java
    Replies: 3
    Last Post: 07-26-2007, 10:18 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •