12
votes

I am using Ant to build a self deploying EXE for a JavaFX application.

Currently Inno Setup places the EXE here: C:\Users\username\AppData\Local\application name

I would like to place this in a different location, and provide the user the option to override this. However I can't seem to find the ant settings to change this.

Is this possible?

Thanks!

2

2 Answers

23
votes

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.

5
votes

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