Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-22-2008, 10:27 AM
Member
 
Join Date: Jan 2008
Posts: 16
sandeeprao.techno is on a distinguished road
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???

Thanks for any help in advance.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 01-22-2008, 11:31 AM
roots's Avatar
Moderator
 
Join Date: Jan 2008
Location: Dallas
Posts: 251
roots is on a distinguished road
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.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 01-22-2008, 11:39 AM
Member
 
Join Date: Jan 2008
Posts: 16
sandeeprao.techno is on a distinguished road
Thank you, I will try it.
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 01-22-2008, 11:54 AM
Member
 
Join Date: Jan 2008
Posts: 16
sandeeprao.techno is on a distinguished road
Do you mean that I should (always)run the program when I start the computer.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 01-23-2008, 07:37 AM
roots's Avatar
Moderator
 
Join Date: Jan 2008
Location: Dallas
Posts: 251
roots is on a distinguished road
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.
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 01-24-2008, 08:16 PM
Member
 
Join Date: Jan 2008
Posts: 20
JAdmin is on a distinguished road
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 09:00 PM. Reason: No url at the end of every post!
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to cancel an individual timer in spite of canceling whole timer Java Tip java.util 0 04-04-2008 03:46 PM
How to determine CPU usage using Java????? JavaEmpires New To Java 2 01-11-2008 12:19 AM
making a count down timer using java saytri New To Java 3 12-29-2007 10:49 PM
Help with timer in java barney Advanced Java 1 08-01-2007 11:24 AM
Problem with timer in java paul Advanced Java 3 07-26-2007 11:18 AM


All times are GMT +3. The time now is 07:50 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org