Hi i am trying to write a program which reads from a properties file the pr

hi,
this is ayesha.
I am trying to write a program wherein i will be reading the value of a property from a properties file which will be true initially. I want to loop in there till the time when the value of the property is false.
The code is as follows:
public static void main(String[] args) {
          ReadingAPropertiesFile propers=new ReadingAPropertiesFile();
          propers.ReadingFileRegularly("F:\\ayesha.properties");
public String ReadingFileRegularly(String FilePath){
          Properties props = new Properties();
          String message;
          String filePath=FilePath;
          try {
props.load(new FileInputStream(filePath));
message = props.getProperty("ayesha");
     boolean theValue = Boolean.parseBoolean(message);
     while(theValue){
          System.out.println("trueeeeeeeeeeeeeeeeeeeeeee");
          Thread.sleep(60000);
          ReadingFileRegularly(filePath);
          catch(Exception ex){
               ex.printStackTrace();
          String messagean="something";
          return messagean;
The contents of ayesha.properties are :
ayesha=true
After 5 minutes it will be set to false so i want to loop in there till the value of ayesha=false at which time i will return
But i dont know how to loop in there for that time:
while(theValue) ?????????????/ what after this???????????
Any suggestons are awaited.

ayeshaparween wrote:
hi,
this is ayesha.
I am trying to write a program wherein i will be reading the value of a property from a properties file which will be true initially. I want to loop in there till the time when the value of the property is false.
The code is as follows:
public static void main(String[] args) {
          ReadingAPropertiesFile propers=new ReadingAPropertiesFile();
          propers.ReadingFileRegularly("F:\\ayesha.properties");
public String ReadingFileRegularly(String FilePath){
          Properties props = new Properties();
          String message;
          String filePath=FilePath;
          try {
props.load(new FileInputStream(filePath));
message = props.getProperty("ayesha");
     boolean theValue = Boolean.parseBoolean(message);
     while(theValue){
          System.out.println("trueeeeeeeeeeeeeeeeeeeeeee");
          Thread.sleep(60000);
          ReadingFileRegularly(filePath);//recursive call this is a bad idea might result in stack overflow error
          catch(Exception ex){
               ex.printStackTrace();
          String messagean="something";
          return messagean;
The contents of ayesha.properties are :
ayesha=true
After 5 minutes it will be set to false so i want to loop in there till the value of ayesha=false at which time i will return
But i dont know how to loop in there for that time:
while(theValue) ?????????????/ what after this???????????
Any suggestons are awaited.I think you better rethink your design , do not use recursion, I would normally use a loop like you did but without loading the content of the file each time, I would use File.l lastModified() method and compare with previous results from this method to see if the file was modified. Then if it was modified then load the new File and check if the property value has changed.

Similar Messages

  • Trying to write a program that you can enter #s and multiply at the end.

    I' m new to java and trying to write a program
    to choose a number between 1-100
    and another entry choose a number between 2-100
    when numbers are picked then they're multiplyed
    can someone please help me??

    I' m new to java and trying to write a program
    to choose a number between 1-100
    and another entry choose a number between 2-100
    when numbers are picked then they're multiplyed
    can someone please help me??Sure. There are lots of folks around here that would be willing to help you (myself included). What are you having trouble with?

  • How to write a program to read any texts in any ABAP program?

    Hi Experts,
    How can I write a program to read specific coding section or any texts in any ABAP program?
    For example, I want to wirte a program to count how many 'LOOP' and 'ENDLOOP' are in any other program.
    Thanks!
    Best regards,
    Hao

    Hi,
    Follow the given below URL for the program to read another Program into an internal Table.
    http://abap4.tripod.com/Upload_and_Download_ABAP_Source_Code.html
    Once the Code is there in the Internal Table , you can do the necessary string search.

  • I'm trying to write a formula to return a blank cell if the condition is met, and to show the numerical difference if not.  Here is what I've written:=IF((F35-F29)=0, " ", (F35-F29)). It is returning 0.00, not a blank cell.  Where is my error?

    I'm trying to write a formula to return a blank cell if the condition is met, and to show the numerical difference if not.  Here is what I've written:=IF((F35-F29)=0, " ", (F35-F29)). When the condition is met (i.e., the difference=0) it is returning 0.00, not a blank cell.  Where is my error?

    Without knowing what is in F35 and F29, I can only guess.  Your formula matches what you said but if F35 and/or F29 are the results of formulas and are decimal numbers (not integers), it is very possible that they are not exactly the same number even though you think they should be.  IEEE Floating Point math often has very very small errors so the answer is not exactly what you would get with a pencil and paper. Try one or both of these things:
    Format the IF cell as scientific. is that 0.0 exactly zero? I suspect it will be some very tiny number.
    Type the exact same number into F35 and F29 and see if your IF formula works as you expect.
    You might need to use ROUND on F35, F29 and/or in your IF formula to get rid of the tiny math errors.
    If you search the forum for floating point math or IEEE 754 you should find more than a few posts about Numbers and floating point math. Or you can read about IEEE 754 on Wikipedia.  It trips up a lot of people.
    Here is a common example.  B2 and C2 are from the formulas shown in B1 and C1. They should both be exactly zero, if done with paper and pencil.  Neither is exactly zero (though I have them formatted with 2 decimals so they appear to be 0.00), they are different from each other, and subtracting one from the other is also not exactly zero.

  • I am trying to create a print ready PDF from a word file with unacceptable results.

    I am trying to create a print ready PDF from a word file with unacceptable results.
    The word file has a trim size of 6” x 9”. It has been set to mirror margins with the inner, top and bottom margins set to 0.75”, the outer margin is set to 0.5” and the gutter to 0.14”.
    It doesn’t matter if I create the PDF from inside Word, or open Acrobat Pro 11.0.9 and click Create From File, while the resulting document size is correct and the odd numbered pages reflect the correct margins, the even numbered pages do not. This results in some text near the outer margin, as well as the page numbers being omitted.
    Does anyone know how to correct this?
    I just noticed that some of the odd numbered pages' text is also cropped. Apparently Acrobat is refusing to set side margins to smaller than 1" (@ 3cm).

    I'm away from my printer, so I'll try it later. Even so, the proposed test is irrelevant. I operate a small publishing house and am trying to upload certain novels to Ingram, the largest book distributor in the world. The specifications I've set are the specifications they've asked for. Since they've said that the results I'm obtaining are unacceptable, and since they demand submission in PDF form, this renders Acrobat Pro for Mac completely unacceptable for anyone in the publication industry. As far as I can tell, Adobe has a serious bug here that it needs to fix—and at once.

  • HOW TO WRITE AND READ FROM A TEXT FILE???

    How can I read from a text file and then display the contents in a JTextArea??????
    Also how can I write the contents of a JTextArea to a text file.
    Extra Question::::::: Is it possible to write records to a text file. If you have not idea what I am talking about then ignore it.
    Manny thanks,
    your help is much appreciated though you don't know it!

    Do 3 things.
    -- Look through the API at the java.io package.
    -- Search previous posts for "read write from text file"
    -- Search java.sun.com for information on the java.io package.
    That should clear just about everything up. If you have more specific problems, feel free to come back and post them.

  • If I have 2 tv's and each their own apple tv can I display the same program to them from my macbook at the same time?

    If I have 2 tv's and each their own apple tv can I display the same program to them from my macbook at the same time?
    for instance Keynote?

    Welcome to the Apple community.
    The Apple TV cannot display keynote presentations or websites from the computer. It can display them via mirroring from the iPad 2 or better or the iPhone 4S.
    You cannot AirPlay to 2 Apple TV 2's at the same time from an iOS device. You can watch the same video, TV show or listen to the same music from your iTunes library on multiple Apple TV's at the same time.

  • I'm trying to import contacts to outlook 2011 from a cvs file.  I've followed all the steps, mapped the fields, clicked import -- it shows that it imported my 900 contacts --- but the contact field remains blank and I can't see any information.  Help?

    I'm trying to import contacts to outlook 2011 from a cvs file.  I've followed all the steps, mapped the fields, etc.  It appears to import all 900 contacts, but after finishing nothing appears in my contact list.  Any ideas on why this is not working?

    Option 1
    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Repair Database. If that doesn't help, then try again, this time using Rebuild Database.
    If that fails:
    Option 2
    Download iPhoto Library Manager and use its rebuild function. (In early versions of Library Manager it's the File -> Rebuild command. In later versions it's under the Library menu.)
    This will create an entirely new library. It will then copy (or try to) your photos and all the associated metadata and versions to this new Library, and arrange it as close as it can to what you had in the damaged Library. It does this based on information it finds in the iPhoto sharing mechanism - but that means that things not shared won't be there, so no slideshows, books or calendars, for instance - but it should get all your events, albums and keywords, faces and places back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one.  
    Regards
    TD

  • How to write a UDF which when encountered it should stop the map

    hi all,
    My task is to write a UDF which when encountered it should stop the map and return what is given as an input to the UDF For ex: UDF(map failed!)
    when this udf is encountered than the map should stop and the output output should be mapfailed!

    <i>But over there it is given to stop a particular mapping step only But my requirement is that i should stop the Entire Mapping process</i>
    UDFs r used in graphical mappings and the details in blog shows that when a UDF stops a mapping, it in turn stops whole messgae mapping. So ur entire Mapping process would get stopped
    Regards,
    Prateek

  • Ical program has disappeared from my computer.  The cache still has my info but there is no program to display it.  Can still see it on my touch.  How do I recover it or where can i re download?

    ical program has disappeared from my computer. The cache still has my info but there is no program to display it.  Can still see it on my touch.  How do I recover it or where can i re download?

    Mark,
    To reinstall iCal:
    1. Insert the Snow Leopard Installation disk into the computer.
    2. The disk will appear on the desktop.
    3. Double click on the "Optional Installs" folder.
    4. Double click on the "Optional Installs.mpkg."
    5. Click on (Continue) in Introduction.
    6. Click on (Continue) in Software License Agreement.
    7. Click on (Agree) to agree to the terms of the software license agreement.
    8. Click on the disclosure arrow ▶ next to Applications.
    9. Select (✓) iCal.
    10. Click (Continue).
    11. After iCal has been reinstalled, download and install the Mac OS X 10.6.8 Update Combo v1.1 to bring iCal up to the most recent version.

  • How to write to stdout and read from stdin using unix pipe = '|'

    Hi,
    How can I read the output written by 1 program to stdout as the input
    (from stdin) to another program?
    Example:
    $java pgm1 | pgm2
    pgm1's output is of multiple lines with tab delimited words in each line. I need to know when each line ends as well.
    Thanks,
    -Ambika

    I tried reading from System.in - using a Buffered reader and the readline() method as follows:
    BufferedReader buffIn = new BufferedReader(new InputStreamReader(System.in));
    while(!(get= buffIn.readLine()).equalsIgnoreCase("")){
    System.out.println("get:<"+get+">");
    but unless I explicitly use the keyboard (type), it doesn't seem to be able to read input.
    I also tried to use
    Properties.load(System.in) - which is really what I'd love to be able to do to reduce processing on my end - but no luck there either!
    Is there anything I need to set the System.in or something?

  • After downloading Adobe Reader X it changes all my programs to read from Adobe

    Everytime I download Adobe Reader it changes all my programs to open from Adobe Reader: for example - interenet explorers icon is changed to an Adobe icon and it is trying to open up as an Adobe file. I have to unistall the program every time to get my other programs to work. What can I do from preventing this because I used Adobe Reader every day for work and it is a pain to keep installing and unistalling after every use!

    Try this -
    In the Finder's Go menu select Go to Folder.
    Type in /Library/Internet Plug-Ins/ and click Go.
    In the resulting Finder window look for anything with PDF or pdf in the name and drag it to the trash.
    Restart the computer.
    Now try viewing the documents.

  • Trying to extrude my logo in AE from a vector file made in AI but AE reads it as transparent.

    Cant figure out what I am doing wrong.  Trying to extrude my logo in AE from a vector outline in AI.  I watched tutorials on how to do both.  My logo imports fine into AE and then I right click on it and choose "create shapes from vector layer".  It then shows all the correct outlines forming my logo but all but a very few outlines are transparent therefore AE will only extrude the few that are filled in with a color.  I select the individual groups and it show that they are filled and are at 100% opacity but they are not.  There is nothing there to extrude.  I've tried changing options in AI and saving it different ways with no difference in the way AE reads it.  Is my LOGO just too complicated? 

    We can't know. We don't know what it looks like. From open paths to things like too many anchor points to unfavorable nesting of compound shapes there could be any number of reasons why it doesn't work. And you have not provided any system or version information to boot.
    Mylenium

  • Read from a .db file and use the values within a program

    each account has 3 values.. (password, balance,id_number)
    my .db file contains the following.
    pass201 250 9885 pass202 300 5547 pass203 700 1123
    (this is 3 accounts)
    I need to be able to read from this file and use each attribute within my program... HELP!

    String[][] accounts = null;
    try
         // Open a file input stream
         FileInputStream fileContents = new FileInputStream("filename");
         byte[] data = new byte[fileContents.available()];
         fileContents.read(data);
         fileContents.close();
         String contents = new String(data);
         StringTokenizer values = new StringTokenizer(data); // using space character as delimiter
         // Using 3 values per line
         int lines = (int)(values.countTokens()/3);
         int columns = 3;
         accounts = new String[lines][columns];
         for(int i=0; i<lines; i++)
              for(int j=0; j<columns; j++)
                   accounts[i][j] = values.nextToken();
    catch(Exception error)
         // debug stuff
    }

  • HT201210 i have tried to restore my phone which isnt working, ive followed all the tips it tells you to follow but nothing is workin. everytime i try to switch my phone on i just get the itunes symbol and a usb cable symbol!! im stuck...can anyone help

    i have tried to restore my phone which isnt working, ive followed a few tips as to upgrade new version but it still isnt working.
    i just get a itues and usb cable symbol when i try to turn my phone on??

    See Here  >  http://support.apple.com/kb/HT1808
    You may need to try this More than Once...
    But... if the Device has been Modified / Hacked / Jailbroken... this will Not necessarily work.

Maybe you are looking for