Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

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

Options
  • 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