简体   繁体   English

使用Inno Setup的JavaFX自安装程序5 - 允许用户更改安装目录

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

I am using Ant to build a self deploying EXE for a JavaFX application. 我正在使用Ant为JavaFX应用程序构建自部署EXE。

Currently Inno Setup places the EXE here: C:\\Users\\username\\AppData\\Local\\application name 目前Inno Setup将EXE置于此处: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! 谢谢!

Actually you can't change this using ANT. 实际上你无法使用ANT改变这一点。 However, as you already know the deploy mechanism uses Inno Setup and you can modify its behaviour. 但是,您已经知道部署机制使用Inno Setup,您可以修改其行为。

During the fx:deploy ANT task a default ApplicationName.iss file is created. fx:deploy ANT任务期间, fx:deploy创建一个默认的ApplicationName.iss文件。 This default file contains eg 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. 所以,我建议运行ANT脚本,复制默认文件并进行修改。 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标志,则可以使用控制台输出来查找创建默认文件的位置以及ANT任务在创建默认文件之前搜索自定义文件的位置:

<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. 相对于ANT构建脚本。

If you got so far, you'll find the line DisableDirPage=Yes in your ApplicationName.iss file. 如果你到目前为止,你会在ApplicationName.iss文件中找到DisableDirPage=Yes行。 Change it to DisableDirPage=No and the user gets the possibility to change the install directory. 将其更改为DisableDirPage=No ,用户可以更改安装目录。

Further you will find the parameter DefaultDirName . 您还可以找到参数DefaultDirName If you want to install your Application to C:\\Program File\\ApplicationName by default you can use the constant {pf} eg: DefaultDirName={pf}\\ApplicationName . 如果要将应用程序安装到C:\\Program File\\ApplicationName ,则可以使用常量{pf}例如: 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). 最初的答案不再适用,因为该功能已添加到JDK中(只是不知道何时,但在使用1.8.0u60左右时它就在那里)。

Just add <installdirChooser> as some <bundleArguments> and set it to true : 只需将<installdirChooser>添加为<bundleArguments>并将其设置为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 免责声明:我是javafx-maven-plugin的维护者

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM