Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Java - Use a flag in properties file to shutdown program?

  • 03-03-2009 12:30PM
    #1
    Closed Accounts Posts: 5,029 ✭✭✭


    Hi,

    I was wondering is it possible to use a flag in a properties file to shutdown a program?

    It doesn't seem to be working for me.

    Start with a shutdown flag of 0 to keep the program running, I then open the properties file, set the flag to 1 and then save it.

    However the program keeps reading the old value of 0.

    Is it possible for a running program to see the new saved data?


Comments

  • Closed Accounts Posts: 5,029 ✭✭✭um7y1h83ge06nx


    I think I found a solution to my problem.

    I was using the following to load my properties file
    private static Properties configParameters = new Properties();
    configParameters.load(Class.class.getResourceAsStream(CONFIGFILE));
    

    which wouldn't pick up the changes to the properties file.

    The following does however:
    private static Properties configParameters = new Properties();
    configParameters.load(new FileInputStream(CONFIGFILE));
    


Advertisement