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 开发者_C百科installer I can create folders under c:\program files, but not from the installer itself.
What am I missing ?
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
Add
<run-privileged/>
to the info
part of your installer.xml.
For example::
<info>
<appname>IzPack</appname>
<appversion>4.2.0</appversion>
<authors>
<author email="" name="Julien Ponge (project founder)"/>
<author email="" name="The fantastic IzPack developers and contributors"/>
</authors>
<url>http://izpack.org/</url>
<javaversion>1.5</javaversion>
<requiresjdk>no</requiresjdk>
<run-privileged condition="izpack.windowsinstall.vista|izpack.macinstall"/>
<summarylogfilepath>$INSTALL_PATH/installinfo/Summary.htm</summarylogfilepath>
</info>
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.
Have you tried with Run As... Administrator option ?
- Run cmd with administrative privileges
- java -jar ***.jar
精彩评论