Hi Tim,
On Jun 7, 2012, at 11:04 AM, Tim Anderson wrote:
> Just to recap to make sure I understand the prolem:
> * Your installer creates the dir in %PROGRAMDATA% belonging to Administrator.
correct
> * Your app is launched via a shortcut
correct (the shortcut is generated by the installer).
> * Your app can't write to the directory as its not launched as Administrator
correct
> My suggestion was to wrap the app as a .exe using launch4j. This way you can configure it to run with elevated permissions.
This is what I'm already doing.
> These elevated permissions should enable the app to write to the dir in %PROGRAMDATA%.
> Is this not the case?
Launch4j will generate an installer exe file. After it's executed you get your application installed and the shortcuts generated. When the user clicks on the shortcut he's logged with his current user and thus the app executes under his user and thus fail to write to %PROGRAMDATA%\XWiki
I'm starting to think that I should do things differently:
* Ask the user who installs XWiki (that's the app I'm creating an installer for) to be logged under the user he wishes to use to run XWiki.
* Instead of copying XWiki writable data to %PROGRAMDATA% use the %APPDATA% directory
* Use a ProcessPanel and run a script during the install to change the permission of the %APPDATA%\XWiki directory so that the current user can write to it (and not just administrator).
Is that way to go in your opinion?
Thanks
-Vincent
> -Tim
>
>
> On 7/06/2012 6:40 PM, Vincent Massol wrote:
>> Hi Tim,
>>
>> On Jun 6, 2012, at 11:33 PM, Tim Anderson wrote:
>>
>>> This came up not long ago:
http://old.nabble.com/%22Run-as-administrator%22-shortcut-property-td33506083.html
>>>
>>> There's no support to specify that the target of a shortcut should be run as administrator.
>>> As a workaround, you could wrap your app in an exe using launch4j; this will allow you to specify a manifest instructing windows to run the app as administrator.
>>>
>>> Take a look at
http://stackoverflow.com/questions/258728/request-admin-privileges-for-java-app-on-windows-vista
>>> which describes how this is done.
>> This is cool. However for some unknown reason to me I already get permission elevation by launch4j even though I don't have a manifest (see my reply to Torsten).
>>
>> Now I don't think this strategy will solve my problem since the elevation will happen anyway and the created dir in %PROGRAMDATA% will belong to Administrator which means the app will not be able to write to it (unless the users modifies the shortcut to run it as admin - which is probably not recommended anyway).
>>
>> Thanks
>> -Vincent
>>
>>> -Tim
>>>
>>> On 7/06/2012 2:09 AM, Vincent Massol wrote:
>>>> Hi guys,
>>>>
>>>> Since I'm installing on Windows7 I am separating what I'm installing in 2 parts: the binaries in Program Files and the data files that should be written to in ProgramData.
>>>>
>>>> So far so good…
>>>>
>>>> However the issue I'm facing is that the ipack-generated installer I have runs with Admin privileges (<run-privileged condition="izpack.windowsinstall.vista|izpack.windowsinstall.7"/>) and thus creates my directory in ProgramData with Administrator as the creator of it.
>>>>
>>>> Then when I start my application using the shortcut generated by my izpack install it cannot write to my ProgramData dir since it doesn't have the permissions…