Hi guys I have created some programs for just learning purpose using Swing, SWT and JavaFx 2.0. I created a installer for them. They work fine after installation except when they are installed in C:\Program files\ in windows7. It become readonly and does not edit the supporting files and even the Sqlite3 database.
Well I know the root of the problem. It is the UAC permission system that requires the Application to run in elevated permission mode to edit any file in C:\Program Files\ folder.
but how to solve it??
Don't install in a protected folder if files need to be modified.
A better solution is to make a clear separation between read only files and writable files. Read only files can go anywhere, as long as files that need to be writable go in the user's home folder where you are guaranteed that the logged in user can write. If you want to be 100% robust you'd give the user the choice of where to put files of course.
Thanks for the reply.
I agree with your solution but then again the solution raises a concern that if I prompt the user to save the files to where he want then I have to store the location of the files in another file which in turn is to be saved in some writable location.....
Not necessarily, you could use the java preferences API to store the location for files.
It is OS specific where this information is stored; under Windows it will go into the registry for example.