Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: How to schedule this to happen daily?

  1. #1
    Junior Member
    Join Date
    Mar 2012
    Thanked 0 Times in 0 Posts

    Default How to schedule this to happen daily?

    Hello everyone,

    Can any of you help me schedule this to run daily at some hour? Thanks...

    import java.net.*;
    import java.io.*;

    public class URLReader {

    public static String outFile = "C://test//Test.txt";

    public static void main(String[] args) throws Exception {
    URL oracle = new URL("http://www.oracle.com/");
    URLConnection yc = oracle.openConnection();

    BufferedReader in = new BufferedReader(new InputStreamReader(
    String inputLine;

    BufferedWriter psout = new BufferedWriter(new FileWriter(outFile));

    while ((inputLine = in.readLine()) != null) {

  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Washington, DC
    My Mood
    Thanked 636 Times in 540 Posts

    Default Re: How to schedule this to happen daily?

    There are a few ways to do this. Either use a Timer, or implement some kind of polling mechanism. Which one you choose is really up to you.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Timer.schedule
    By johnboyofsj in forum Java Theory & Questions
    Replies: 1
    Last Post: October 14th, 2012, 10:02 PM
  2. [SOLVED] Is there a way to make things happen if a certain text is entered in a TextField?
    By DusteroftheCentury in forum Java Theory & Questions
    Replies: 25
    Last Post: January 26th, 2012, 08:14 PM
  3. Program to calculate pay and total sum with daily increment. Urgent!
    By ePerKar3 in forum What's Wrong With My Code?
    Replies: 11
    Last Post: December 5th, 2011, 01:20 PM
  4. why could this happen?
    By bvk1013 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: October 17th, 2011, 10:48 PM
  5. How to schedule a Java Program for Background processing
    By rangarajank in forum Java Theory & Questions
    Replies: 5
    Last Post: May 13th, 2010, 03:57 AM