I have made a small application in Java and I would like to make a windows installer for it using the Nullsoft Scriptable Install System (http://nsis.sourceforge.net/Main_Page).
The application I made needs to save user preferences somewhere and it currently saves it in the user’s home directory (e.g. c:\Users\danny or /home/users/danny). However if the windows installer installs the application to e.g. c:\Program Files\whatever\ I should probably save the preferences file there too, right?
How would I detect that directory path in Java? What would be a good cross-platform approach to this without losing the benefits of a windows uninstaller for windows users e.g. start menu icons, installer option, etc?
Should I just continue saving my preferences in the user’s home path and clutter it up?
Thanks very much,
the best place for saving user’s preference is user home directory.
Also it is good from security point of view.
To get the path from java:
It is cross platform. (/home/username in Linux (or like this depends on OS configuration) C:\Documents and Seetings\username in windows)
More properties: http://www.mindspring.com/~mgrand/java-system-properties.htm
Also, make sure that you app has enough privileges (for applet it should be signed)