Small program that checks every minute if a file exists...

Hi,
I am an experienced JSP programmer and now I have to do something different and I have no clue how to do it and even what keywords to search for.
I need to make a small Java program that checks from time to time (every minute) if a file exists and if so performs some tasks.
I would appreciate most of all some keywords to search for. I don't what this kind of program is called. I have no problem with the code that checks the existence of the file etc. Some code would be also appreciated.
I just don't know how to check that every minute.
Thank you very much!

For the once-per-minute part, you'll want java.util.Timer and java.util.TimerTask, or else just a loop with a Thread.sleep call in it.
For the file, assuming it's on the local file system where the program will run, you'll want the java.io.File class.
If you're not familiar with Java, you'll definitely need a tutorial. There are links to some under Resources for Beginners at http://www.thejword.com/3.html#beginner_resources

Similar Messages

  • How would I set this small program to activate every 120 seconds?

    I have this small program that writes the value 0 to a file, but I want it to only activate every 120 seconds, so it doesn't take up a bunch of system resources by constantly running. Can I make it pause for 120 seconds, or set a timer for it, in such a way that it won't make my PC run slow? Here's my code. Thanks if you can help.
    import java.util.*;
    import java.io.*;
    import java.io.File;
    public class Purge extends Random implements Serializable {
         public Purge () {
              writePrimDoubles();
         public static void main (String [] args) {
              Purge test = new Purge();
         public void writePrimDoubles() {
              DataOutputStream outStream;
              long timerStart;
              long timerEnd;
              long size;
              int a = 1;
              try     {          
                   while (a==1) {
                        outStream = new DataOutputStream
                             (new FileOutputStream("packetlog.txt"));
                        timerStart = System.currentTimeMillis();
                        outStream.writeBytes("0");
                        timerEnd = System.currentTimeMillis();
                        outStream.close();
              catch(IOException e) {
                   System.out.println("Error writing to file");
    }

    java.util.Timer, I think may do the trick.

  • I upgraded to OSX.8 and cannot load MS Encore. I desperately need some email files from ENCORE. Is there a program that can open my ENCORE email files?

    I upgraded to OSX.8 and cannot load MS Encore. I desperately need some email files from ENCORE. Is there a program that can open my ENCORE email files?
    SLM01

    Do you mean Entourage? It appears you have Office 2004 or older. Those are PowerPC apps only and will not run in Lion or later. If you need access to those emails like, "RIGHT NOW!", then I would suggest purchasing Office 2011 for Mac. Outlook is the new Office email client in 2011 and can import your older Entourage data.

  • HELP: NEED PROGRAM THAT CAN CONVERT A RM/RMVB FILE.

    hey do you guys know of any good programs that can convert a RM/RMVB file to AVI, MOV, MPG, or something of that sort? I tried to play the RM file on my realplayer and it works but it's subtitles are completely messed up so I might as well convert the file to play it on another player. Thanks so much in advance.

    http://www.topdrawerdownloads.com/download/104525
    Joe

  • Small clock that appears every few seconds

    hi! i just had my first bb - curve 9300.. i must've done something in the settings or something, cause there's this annoying small clock that keeps appearing every few seconds, which makes my phone work slowly, how do i remove it? thanks!!

    candie026 wrote:
    hi! i just had my first bb - curve 9300.. i must've done something in the settings or something, cause there's this annoying small clock that keeps appearing every few seconds, which makes my phone work slowly, how do i remove it? thanks!!
    To prevent freezing or lagging/slow response on any BlackBerry, the most important practice you can adopt is to be sure to CLOSE applications when you are finished using them.
    If you just hit the red "end call" key to go back to the home screen the application actually stays open and running in the background. If you do this repeatedly you will have lots of apps open and consequently your memory will get used up. Lack of memory is the biggest reason your BlackBerry slows to a crawl or locks up. If you get into the habit of actually using the menu key to close the applications this will at least slow down this memory-clogging process. You still may have to do a battery pull or use the "Quickpull" app once in a while when things get slow.
    To check what applications are running on your device in the background, press the Menu key then choose Switch Applications. You will see the icons of each application there.
    So now, check your applications running in the background. There are commonly four or five applications that will always be running (Messages, Call Logs/Phone, BlackBerry Messenger, Homescreen, and the Browser; there are other third party applications such as BeeJive, and BlackBerry Alerts which will also run in the background which you cannot close if you want them to operate). Make certain that the browser is NOT on an active webpage (open the browser and choose Menu > Close). Close any other applications that do not need to be running (the camera or a game you were playing or Google Maps).
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • HT5910 Help me find a program that will allow me to tag files with color over file name and not just a small dot that is not easy to see.

    Need help to find program that allows me to relabel files with a bold color that is easy to recognize and not just a small nearly invisible dot at the end of the line.

    That's one of the many features in the feature-packed "Finder Sustitiute" file brower program, Path Finder, by CocoaTech . It's extremely powerful, with enhanced searching, file list filtering, and batch file operations. It also has an amazing preview mode for most all file types. 

  • Question: Programs that work with Nikon D600 .NEF files

    I recently upgraded to the Nikon D600.  With that, I’m unable to open RAW images in the programs that I currently have (PS Elements 9).  Does Photoshop Elements 11 have the correct software (Camera Raw 7 and higher)?  Or will I need to get the full version Photoshop CS6?
    Thanks for any help you can offer!

    PSE11 will handle your NEF files but you will need to update immediately after installation using:
    Help >> Updates
    Also look at Lightroom 5. Unlike Elements it has all of the raw tools from CS6 in an intuitive interface designed for photographers by photographers.

  • TS3276 incoming messages are not shown automatically even though in 'preferences' i have set to check every minute. I have to click the mail icon to see new messages. phil

    incoming mail does not appear automatically even though preferences is set to check for new mail every minute

    If by download bar you are referring to the spinning gears, they are gone in Mail 6.5. There is no indication Mail is checking for Mail. If it finds Mail, it will show it downloading in the lower left hand corner.
    Under the Window menu there is Activity. Try opening it and you should be able to see if Mail is checking for new mail.

  • Is there any small program to check o/p voltage and waveform generation when i/p is thermocouple o/p

    I have purchased pci 6024e DAQ and I want to check the card with using thermocouple and with the help of Visual Basic 6.
    Please help

    The best way to check to make sure your Data Acquisition (DAQ) board or card is working is to run Measurement and Automation Explorer (MAX). From MAX, you can make sure that the card has computer resources assigned to it and also read any channel and display the voltage on the screen. You may also output a voltage (if your board has analog output capability) from MAX.
    I would suggest running MAX, connecting up the thermocouple to the card, and reading the voltage reported by MAX to make sure the voltage reported is correct. To check the analog output, I would connect the analog output to an analog input channel and make sure whatever voltage is output is also read in correctly.
    Once the board is working correctly in MAX, you can begin development with Visual Basic. You
    can use the standard NI-DAQ function calls, or, for faster, easier development, consider using the ComponentWorks for VisualBasic software. See www.ni.com/products and look for Measurement Studio for more information about ComponentWorks.
    You can find more about MAX at www.ni.com/support/daq. This page covers installation problems, but also shows how to test the functionality of the card with MAX.

  • Is there any way to use microsoft outlook 2010 on ipad? Or is there apple app or program that will copy over all of the existing structure, folders, etc... and sync?

    I recently received a gift of a new ipad. Unfortunately I can't really switch from my Windows lap top until I figure out a way to use the ipad for my business emails which I use Outlook 2010 for. There are a singnificant amount of folders and history, with various attachments, that I have to have access to and I have been unable to find a way to move all of this over to the ipad. I use Yahoo mail for my primary mail server and can get the Yahoo mail on the ipad with no problem. But I do not have the full folder structure set up on Yahoo that I have on Outlook 2010 and to do so would be very time consuming...and I'm note even sure how I could move all the folders back to Yahoo and all the emails contained in them, many of which have been long deleted form Yahoo, back to Yahoo. Ideally I would just install Outlook 2010 on ipad and export all the files over. But there doesn't seem to be any Outlook 2010 program for ipad...if there is, please tell me about it. Otherwise, I need a relatively quick alternative that will not force me to recreate my entire Outlook 2010 folder structure and copy emails over folder by folder. If anyone has had the same issues, and was able to solve them, I would very much appreciate knowing how to do this. I like the ipad and want to use it for my main platform. Thanks

    Welcome to the Apple Support Communities
    Microsoft will launch Office for iOS next year, so you have to wait, Instead of Outlook, use Mail on the iPad

  • How can I check every 5 secs a file Length with Threads?

    As a matter of fact the subject is the main question.
    I need your HELP! PLEASEE!!

    import java.io.*;
    public class RFile implements Runnable {
         public static void main(String args[]) throws Throwable {
              RFile rf = new RFile(new File(args[0]));
              new Thread(rf).start();
         File file = null;
         public RFile(File f) {
              file = f;
         public void run() {
              try {
                   while (true) {
                        System.out.println(file.length());
                        Thread.sleep(5000);
              } catch (Throwable err) {};
    }

  • HT203175 I have 2 episodes of 2 TV programs that have been stuck in processing file for several hours.How do i get the program to finish?

    I've been download 2 episodes from the itunes store. They have both in "processing file" mode for hours. The amount of MB of the files are complete but the downloading icon is still going. How do I get these 2 episodes to finish the processing file mode?

    Rammses-
    Try following the steps in this article, and try to go about restoring your iPod again. See if you can't get it to work...
    http://docs.info.apple.com/article.html?artnum=302538
    Also, it never hurts to try to put the iPod into disk mode whenever you're going to restore it.
    http://docs.info.apple.com/article.html?artnum=93651
    Best wishes,
    CG

  • Is there a program that will check for viruses or other reasons why it runs slow?

    For several months my iMac has been running slow or freezing often. Safari often quits unexpectedly as does mail on occasion.

    Programs that check for viruses are a major cause of slow Macs, so let's look at doing steps that don't handicap your computer:
    1) How full is your hard drive? You need a minimum of 10G free for background processes such as Virtual Memory.
    2) How much RAM is installed? RAM for the Mid-2010s is rather cheap at the moment, I upgraded my 27-inch Mid-2010 recently from the original 4GB to 12 GB for about US$55. Installation took only minutes.
    3) If you have an external hard drive for backups, are you using something other than Time Machine to do the backups. Many third-party backup programs can cause a performance hit.
    The next step is a little longer. It checks to see if some runaway background process is eating processor cycles and slowing you down:
    1) Use your computer normally for typical tasks for several hours, then quit any applications you have launched. Do not restart.
    2) In Applications > Utilities, find Activity Monitor. If you've not used it before, you have to change a setting. At the top of the AM window is a "Show" option. By default it is set to show "My Processes." Change it to "All Processes" like this:
    4) Now highlight the "%CPU"column as shown so the most active processes "bubble"to the top (tiny arrow points down).
    Now watch things move up and down for a minute of two. What you are looking for is any single process that is using more than about 10 percent of the processor cycles while the computer is idling. If you see one doing that, post its name in a reply here.
    Awaiting your report,
    Allan

  • Small issue in small program(code) that need to be fixed ...

    Hi Guys ,
    i need ur help in some kind of issue( technique thing ;) ). i have done small program that ask for numbers then print them and told u how many Odd numbers.
    the issue that i have it, is that the program when print the result (the numbers) it print them correctly but print with them word "null".
    i need ur help to avoid that word.
    How???
    sorry for my bad english, since i don't know english well.
    and thank u soo much for ur help ;)
    this is the code:-
    import javax.swing.JOptionPane;
         // takes number from the user and show u the odd number and print them
    public class Odd {
         public static void main(String[] args) {
              String n,m;
              int a=0;
              int x=1;
              String result = null;
              n=JOptionPane.showInputDialog(null,"How many number do you want to check for the odd ? ");
              int n1 = Integer.parseInt(n);
              int array[]=new int[n1];
              for(int i=0;i<array.length;i++){
                   m=JOptionPane.showInputDialog(null,"Enter number "+x);
                   array[i] = Integer.parseInt(m);
                   result=result+array[i]+"\n";
                   x++;
                   if( array%2 !=0 )
                        a++;
                   JOptionPane.showMessageDialog(null,"The Numbers Are :\n"+ result);
                   JOptionPane.showMessageDialog(null,"The Odd Numbers are:\n " a" Numbers");

    First of all you don't need to feel yourself sorry. Here is a Java forum not an english literature forum and at least I can understand you. At least you don't try to write in your language which we probably may not understand.
    Secondly if you initialize your String value like that you have the null value. You can initialize it like
    String result = new String(); and try it again.

  • Purple LED flashing every minute

    I cannot find the source of this Purple LED that flashes every minute.  It even flashes when in Bedside Mode.
    I have looked through all Apps in Settings >> Notifications.
    I had an App called 'Power Tools' installed. This allows for the changing of LED colours, but I never implemented the app, and did check all possible LED changes in the App, but none were set.  I have since removed the App, but the LED continues to blink every minute.
    Can anyone give an idea of where to look for possible sources of this blinking LED?
    Thanks very much !
    Solved!
    Go to Solution.

    dragonfly888 wrote:
    Shouldn't I be able to see CPU activity when the LED fires off?
    Probably not, the LED uses very very CPU and battery. You know how those little cheap LED lights you buy at cash register checkout counters can last for years....?
    I don't see the app that might causing it.
    Look in your App World > My World > Apps ? Installed.
    Anything like BeBuzz, Hub++ or something in there?
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

Maybe you are looking for