Reputation: 3538
I have a standalone Java application which i shall be shipping to the customers. The first time the exe is run I would like to show some welcome messages,configuration details etc. Its like a one time helping out the user to get started
How to reliably ascertain that my application is run for the first time? I have a log4j logger file that I shall create on the users system for logging. I was thinking of using its timestamp.
Is there an industry standard approach to this probelm?
Upvotes: 2
Views: 64
Reputation: 136002
Take a look at java.util.prefs package. It allows to write / read config data in system dependent storage, eg Windows registry
Upvotes: 3
Reputation: 732
Read and write Properties files. One property can be "Run before?" with a default value of "0" or "never". You don't even have to have the property in the default file because you can supply the default in the program call querying the property. You don't even have to have a property file because the program can write one out the first time. Thus the mere existence of a property file can be a cue to the program that it has run before.
Approaches like this can lead to self-installing programs (with or without user options asked via gui).
Upvotes: 2