2

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.

Stefan
  • 17,448
  • 11
  • 60
  • 79
Sudeep
  • 153
  • 1
  • 1
  • 12
  • As far as I know, the programs files directory was always protected. Are you sure that the win7 user isn't a admin with low UAC settings? – Stefan Jun 08 '18 at 10:01
  • Ps; you might want to check %programdata%, %appdata% etc, : see https://stackoverflow.com/questions/16276139/what-is-the-difference-between-programdata-and-appdata#27181428 – Stefan Jun 08 '18 at 10:02
  • 1
    @Stefan, Sorry, i missed to check the UAC setting in Windows 7. It was set to low, so set it to default and the same issue persists as in Windows 10 – Sudeep Jun 08 '18 at 10:38
  • I am in doubt to post it as answer, although it seems a simple thing, it's also easy to overlook. I'll post it but also flag your question and let the community decide. – Stefan Jun 08 '18 at 10:40

1 Answers1

2

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.

Community
  • 1
  • 1
Stefan
  • 17,448
  • 11
  • 60
  • 79
  • But, this is not the case with my 32-bit application. When a 32-bit application is installed in C:\Program Files, i don't see this kind of problem. Is it something to do with the bitness ? – Sudeep Jun 11 '18 at 05:37
  • Stefan, Does the above comment make sense ? – Sudeep Jun 11 '18 at 13:51
  • Hmm, no. As far as I know program files is protected by default. But... security settings can be changed. Btw, the 32-bit folder typically is `c:\program files (x86)` – Stefan Jun 11 '18 at 13:52