问题
My Java RCP application (App.exe) was recently converted from 32-bit to 64-bit. Since it is a 64-bit application i have used NSIS to create an installer which will dump all the required files along with App.exe in C:\Program Files. When the App.exe is run, i am getting a security exception(Access denied) when the application tries to open files (in C:\Program Files) in edit mode to dump the results/logs. When i run App.exe as administrator it works fine. It also works fine in windows 7 64-bit machine even when run in non-admin mode.
Any idea, as what to do to run App.exe in non-admin mode ?
Note : This is not the problem of NSIS as samething was working fine as a 32-bit application.
回答1:
Basically, the programs files directory is always protected.
You should check the WIN 7 users privileges and the user's UAC settings.
Meanwhile....
You might want to reconsider where to store your data.
There is a SO post about that here
To put it straight, ProgramData contains application data that is not user specific.This data which will be available to all users on the computer. Any global data should be put in here.
AppData folder contains configuration settings, downloaded information/files for a particular user. So, for example any user specific preferences and profile configurations can be stored in the AppData folder. The AppData folder is further divided into three subfolders
Roaming - This folder contains data that can move with your user profile from a computer to another.
Local - This folder contains data that will not move with your user profile.
LocalLow - You can put in lowlevel access information such as information related to web browser running in a protected mode in this folder.
来源:https://stackoverflow.com/questions/50758075/why-does-my-application-requires-admin-priviliges-when-placed-in-c-program-file