Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Java Programming Issue
Name: vertigo84 Date: April 24, 2004 at 07:11:44 Pacific OS: XP Pro CPU/Ram: 2200 Athlon, 512 DDR
Comment:
This is probably something simple i'm missing, but i have written a program that will take a raw data file, and convert it to HTML and output the the webpages. This needs to happen every hour, as other software updates the raw data logs. My problem is that I can not make my java program wait in the background until each new hour roles around. My program essentially needs to run forever, obtaining the raw file and processing it about 5 minutes after the hour. Does anybody have a suggestion for this. I tried just using a while loop that checks the Date class for the time, but the CPU resourse usage is maxed, which is not good
Name: tl1_mossman2 Date: April 24, 2004 at 20:44:03 Pacific
Reply:
i would advise using a while loop to put it in infinite loop, and then, using Thread.sleep(int) ... think length is measured in thousandths of a second, but, could be wrong
another option, if ye'r running linux, you can create a cron job to call the java prog once an hour at five minutes after
0
Response Number 2
Name: gpp Date: April 25, 2004 at 16:02:51 Pacific
Reply:
If you're running windows, then use an AT job. Having a program 'run forever' and check the date is really not an ideal solution.
0
Response Number 3
Name: wharfie Date: April 26, 2004 at 19:12:36 Pacific
Reply:
Another approach would be to use a Java Timer and a TimerTask.
Summary: Hello, I have to create java program using Array, which my teacher said would be a lot easier. However, I am not sure how to write this, as I am a newbie at java. Could someone please help me with thi...
Summary: Notepad can't run Java programs (unless Microsoft has secretly built it into Notepad... big conspiracy, hmmmm). Try giving us some more information about your problem and your attempts to solve it for...
Summary: I don't know how to do this but might be able to help point you in the correct direction. I'm very sure that you use JDBC drivers to connect from a java program to an Access database. Try doing a goo...