12

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!

purring pigeon
  • 4,141
  • 5
  • 35
  • 68

2 Answers2

23

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.

gfkri
  • 2,151
  • 21
  • 23
  • Thanks - this was perfect... So easy to follow. :) – purring pigeon Feb 09 '15 at 15:16
  • One issue though. I used {pf}/ApplicationName - however while it prompted to confirm install location, it still was placing it in C:\Users\username\AppData\Local\application name – purring pigeon Feb 09 '15 at 15:23
  • This was a result of the default setting: UsePreviousAppDir. I needed to uninstall first, and then it used my new location. Thanks! – purring pigeon Feb 09 '15 at 15:55
  • I have moved to a maven build and have been unsuccessful at getting the customized ISS file to be used. I have placed it in src/main/deploy/package/windows/appname.iss but it will not pick it up. Have you had any luck with that? – purring pigeon Jul 14 '15 at 22:10
  • Unfortunately, I don't have any experience with this case. – gfkri Jul 17 '15 at 13:26
5

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

FibreFoX
  • 2,858
  • 1
  • 19
  • 41
  • I have add true which does not work. The output Native installer exe still won't ask me what dir to intall. – Maxi Wu Aug 11 '17 at 06:08
  • @MaxiWu Have you checked that your JDK is up2date? Older versions did not include this feature – FibreFoX Aug 11 '17 at 07:09
  • I look up my project->properties->java build path. It is JavaSE-1.8 jre1.8.0_131. There is another option JavaSE-1.7 jdk1.8.0_40. I will intstall latest jdk and try again. thanks. – Maxi Wu Aug 11 '17 at 08:13
  • you are right, after update to 8u114, it works. thank you. – Maxi Wu Aug 11 '17 at 08:31