JavaFX Self Installer With Inno Setup 5 - Allow user to change install directory

て烟熏妆下的殇ゞ 提交于 2019-11-30 01:25:16

Actually you can't change this using ANT. However, as you already know the deploy mechanism uses Inno Setup and you can modify its behaviour.

During the fx:deploy ANT task a default ApplicationName.iss file is created. This default file contains e.g. the setting, which is responsible for the install directory. This default file is only created, if you don't provide any customized on your own. So, I would recommend to run the ANT script, copy the default file and modify it. If you enable the verbose flag of the fx:deploy task you can use the console output to find out, where the default file is created and where the ANT task searches for your customized file before creating the default one:

<fx:deploy
    ...
    verbose="true">

    <fx:info title="${appname}" vendor="${vendor}"/>
    ...
</fx:deploy>

In my case I found the default file in

C:\Users\gfkri\AppData\Local\Temp\fxbundler3627681647438085792\windows

and had to put the customized file to

package/windows/ApplicationName.iss

relative to the ANT build script.

If you got so far, you'll find the line DisableDirPage=Yes in your ApplicationName.iss file. Change it to DisableDirPage=No and the user gets the possibility to change the install directory.

Further you will find the parameter DefaultDirName. If you want to install your Application to C:\Program File\ApplicationName by default you can use the constant {pf} e.g.: DefaultDirName={pf}\ApplicationName.

The original answer is not true anymore, because that feature got added to the JDK (just dont know when, but it was there when using 1.8.0u60 or so).

Just add <installdirChooser> as some <bundleArguments> and set it to true:

<plugin>
    <groupId>com.zenjava</groupId>
    <artifactId>javafx-maven-plugin</artifactId>
    <version>8.4.0</version>
    <configuration>
        <mainClass>your.mainclass</mainClass>
        <verbose>true</verbose>
        <bundleArguments>
            <identifier>SOME-GUID-USED-FOR-UPDATE-DETECTION</identifier>
            <installdirChooser>true</installdirChooser>
        </bundleArguments>
    </configuration>
</plugin>

Disclaimer: I'm the maintainer of the javafx-maven-plugin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!