How to store the configuration information in the suncertify.properties. Is it use the Properties class ? If yes, how to specify the properties file is suncertify.properties and location at current directory when create Properties Object? Is it use getProperty/setPropertyto read/store the properties ? Thanks.
Hi Andrew, Thanks. The problem of read/store properties is solved. The following line is stored in suncertity.properties. databaseLocation=C\:\\kwwong\\db-1x3.db If I summit the assignment with this properties file, the examiner will update the filepath for data file, is it O.K. ? Should I handle the path-separator on Win/Unix system ? Or let the user set the databaseLocation on the first time the application running ? Thanks
author and jackaroo
Hi kwwong I would not submit anything to Sun that has a local path in it. I would recommend not shipping any properties file - generate one when the user first starts the application. Prompt them for the location of the database etc., then store the data in the newly created properties file. Then every time after that, the properties file can be read to see the last defined information. If you want to go the extra mile, you could try and work out where the database is likely to be (it might be in the current working directory or it might be in the same directory as the jar file) and then you can offer the found location as a default to the assessor. I found this very easy to do, and it is a nice feature, but not essential. Regards, Andrew
Hi Kwwong, Be aware that we must handle the fact that we have one properties file shared by 3 applications (server, client, stand-alone) if we run them on the same machine. So we should put a locking mechanism in place. Conceptually, loading and saving properties mean : Loading: -------
In another thread, Andrew proposed a nice way to perform the lock based on creating a temporary file. It seems perfect. Regards, Phil.