PROBLEM : while developing a java application or any windows application,writes a program to create a file in c drive but getting an error "Access Denied". Try to create an empty file in the C drive root directory manually, but no options to create any files, only new folder is allowed, although The logged in user is under administrator group.
SOLUTION
C:\your-file.txt - NOT OK
SOLUTION
In Windows 7 or 8 (may be Vista), users (even administrators) are not allowed to create files in the C drive root directory, otherwise, an error message like “A required privilege is not held by the client” or “access is denied” will be prompted.
To fix it, just turn off the User Account Control (UAC). In Windows 8, do not turn off the UAC via control panel, it must go through the registry.
- Press keys “Windows Key + R”, type
regedit
- Locate
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA
- Update the
EnableLUA
value to 0 (turn if off) - Restart Windows.
Alternatively
1. Go to control panel >> user accounts >> user account control settings >> set to never notify
2. If you think it’s not safe to turn off the UAC feature, then create a new folder under the C drive root directory and put the file inside.
C:\folder\your-file.txt - OK1. Go to control panel >> user accounts >> user account control settings >> set to never notify
2. If you think it’s not safe to turn off the UAC feature, then create a new folder under the C drive root directory and put the file inside.
C:\your-file.txt - NOT OK