I've just Installed Windows 7 and I want to compile the class in C drive, but whenever I try to compile any class I'm getting an error(the following for Java):

  Unknown.java:1: error while writing
         Unknown: Unknown.class (A required
         privilege is not held by the client)

         class Unknown 
         ^ 1 error

How can I enable windows 7 to compile all the class in C drive, just like it can in other drive?

link|improve this question

75% accept rate
feedback

3 Answers

up vote 1 down vote accepted

This can happen if permissions are incorrectly set for your C: drive.

You can take ownership of the drive like so:

  • Right-click the C: Drive and click Properties.
  • Go to the Security tab.
  • Click Advanced then click the Owner tab.
  • Make note of the current owner if you want to restore it later in case
  • In the list of names select your user name, or click the Administrators group.
  • Click Edit and check Replace all existing inheritable permissions on all descendants with inheritable permissions from this object to apply this recursively.
  • Click OK, and then click Yes for this message:

This will replace explicitly defined permissions on all descendants of this object with inheritable permissions from C-Drive (C:). Do you wish to continue?

  • Wait until the permissions are replaced, click on OK.
link|improve this answer
You're suggesting he completely overwrites all the permissions on his C: drive? Seems like that could have lots of unintended consequences. It's not like XP where permissions don't really matter. – davr Jan 18 '10 at 23:39
This answer only takes ownership, which is different from other various security permissions and will not cause problems. That said I did have had problems (errors, crashes, etc.) after trying to strip all permissions and giving "full access" to "Everyone" in program files and user folders on win7 x64. Probably just poor user action, but I recommend to be cautious and change the permissions only where needed. – mtone Jan 19 '10 at 1:02
feedback

Place your code files in a subdirectory of your user directory instead of in the root of the C drive. Users are prevented from writing directly to the root C drive for security reasons.

link|improve this answer
feedback

If I assume you mean the root of the C drive, then this could be related to UAC which by default disallows writing files to the root of the system drive.

If you need to compile out to the root drive, then another option is to launch your application as administrator (be it the command line or some IDE). You can usually do this through the context menu of the application on the Start Menu, or the Application's executable.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.