Java Programming Problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have administration privilages on my computer but when ever I try to save a
java file off of NotePad into my C:\ drive or any of their sub folders except
my documents, I get a message box saying I dont have permission to save the
file in that place and to contact my administrator. I just got vista so I
don't know much about how to work it yet.
 
Death_Delver_Grim said:
I have administration privilages on my computer but when ever I try to save a
java file off of NotePad into my C:\ drive or any of their sub folders except
my documents, I get a message box saying I dont have permission to save the
file in that place and to contact my administrator. I just got vista so I
don't know much about how to work it yet.

Programs run even by a user with "administrative" privileges usually
only have "user" access to the system. That's why when you install
software, you get a "User Account Control" (UAC) prompt asking for the
installation tool to be given administrative access. The idea is that
even when you're logged on as an administrator, most programs only
actually need user access, so that's all they get by default. Others
have given better, more detailed, descriptions of it - try searching
these forums or the web for "UAC" or "User Account Control".

So that's why you have the problem. As for what to do about it, you have
several options, assuming you do actually need to write to C:\ or a
subfolder of it...

1. Turn off UAC. Not recommended as it removes the extra security it
offers, and seems to sometimes break other things.
2. Set permissions on the entire C:\ drive to give your "administrator"
username full control. Only slightly better than turning off UAC, and
still not recommended.
3. Presumably you are not trying to write to C:\ (you should hardly ever
need to), but to a subfolder of that drive. Give your username full
control of just that folder.
4. More experienced users may be able to give other suggestions. I've
only been using Vista for a few weeks myself.

You don't say why you need to save Java files to C:\, or any other
folder than your documents, but if it's to get around the previously
frequent problem with spaces in paths such as "C:\Documents and
Settings\UserName\My Documents\", that's no longer a problem. The path
to your documents is "C:\Users\UserName\Documents\" - no spaces in that,
at last :D Provided your UserName contains no spaces - if it does, you
may want to consider changing it to one which doesn't, or at least
change the profile path. I'm not certain how to safely do that, but I'm
sure others here do. Pity C:\Program Files\" still has a space...
 
Death_Delver_Grim said:
I have administration privilages on my computer but when ever I try to save a
java file off of NotePad into my C:\ drive or any of their sub folders except
my documents, I get a message box saying I dont have permission to save the
file in that place and to contact my administrator. I just got vista so I
don't know much about how to work it yet.

When a program is run (even by an administrator) it's run with the
privileges of a normal user unless it's elevated to admin access (those
UAC dialogs you see when you install things are doing that).
This is basically the Windows version of sudo.

If you right-click on an application, and choose "run as administrator",
(and accept the UAC prompt) it'll run with admin access and be able to
do whatever it wants.
You want to run the JVM as an administrator. I'm not sure if Sun has a
nice method of doing this. A (bad) workaround would be to right-click on
java.exe, go to properties, go to compatibility settings and check "Run
as Administrator".
If Java is integrated with explorer on your system, you might be able to
right-click on .jar files and choose "Run as Administrator"

Alun Harford
 
Back
Top