views:

614

answers:

3

I have an installer written in Java using Izpack. It works OK on Windows XP, however on Windows 7 it cannot write to c:\Program Files. Strangely enough, as a user running this installer I can create folders under c:\program files, but not from the installer itself.

What am I missing ?

+3  A: 

in order to write to this path, the installer would need to ask for and been granted run as adminsitrator privledges.

For Java: Run the CMD prompt as admin or powershell as admin and navigate to JAVA's Bin dir....and run java.exe -jar #Full path of your jar file# that will get it the privledges

Alex
I'm running the application as admin. As I already mentioned, I can create files and directories under c:\program files as the user running the installer, but the installer cannot!
Demiurg
There is a big difference between being an admin user and running an application 'As Administrator' . Right click on the installer and you will see a sheild icon with run as administrator next to it. Choose that option.
Alex
Run the CMD prompt as admin or powershell as admin and navigate to JAVA's Bin dir....and runjava.exe -jar #Full path of your jar file#that will get it the privledges
Alex
+1  A: 

You need to run the installer as admin. Only admin can write to the Program Files directory. Usually when a user tries to make changes, the UAC asks if you're sure. This isn't necessarily true for a program.

Joel
I am running it as admin, please see above for more details
Demiurg
Running as admin in Windows Vista and 7 doesn't mean running as admin in Windows XP. You still have grant your software privileges for the UAC.
Joel
Also, those privileges are not transitive. If your host program has been granted UAC access, the child, by default, isn't.
Joel
+1  A: 

Have you tried with Run As... Administrator option ?

anthares
As the installer is a .jar file, I cannot use "run as", but again, this is not the issue - I'm running it as an administrator
Demiurg
If you are logged in as administrator, this doesn't mean the application you run will gain administrator privileges.
anthares
To be more specific, you're not running as admin. You're running as a privileged user who can elevate to admin, with UI confirmation. For example, whenever you create a folder in Explorer, you should get an UAC confirmation prompt asking if it's okay to do so. There's no way to work around that one (short of disabling UAC) - and it's not magically shoehorned on all applications. Your app has to know about this issue, and request the system to elevate (popping up the UAC dialog and asking the user if he is okay with that) whenever you need "real admin" access.
Pavel Minaev

related questions