Search code examples
javadesktop-applicationautosave

How to implement autoload in a Java application


So I'm writing this JFrame application that has its own document model that can be loaded and saved to a filepath. I'm wondering what good ways are there to make the application open the last saved file when it starts up.

Do I store last saved document filepath in a proprietary way or is there some facility in java that can handle this for me?


Solution

  • Why not use the Java Preferences API ?

    That allows you to store settings/properties per user and/or per system. They'll be persisted automatically (via files in Unix/Linux, and in the registry in Windows, IIRC).