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

后端 未结 2 1878
情书的邮戳
情书的邮戳 2020-12-25 07:49

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 nam

相关标签:
2条回答
  • 2020-12-25 08:40

    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

    0 讨论(0)
  • 2020-12-25 08:45

    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.

    0 讨论(0)
提交回复
热议问题