有没有一种方法可以使用jpackage更改安装程序文件的图标? [英] is there a way to change icon of the installer file using jpackage?

查看:141
本文介绍了有没有一种方法可以使用jpackage更改安装程序文件的图标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的模块化Javafx应用程序.

I have a simple modular javafx application.

我使用

dir /s /b src\*.java > sources.txt & javac --module-path %PATH_TO_FX% -d mods/hellofx @sources.txt & del sources.txt

这将创建mods目录

然后我使用命令创建运行时映像

I then create runtime image using the command

jlink --module-path "%PATH_TO_FX_MODS%;mods" --add-modules hellofx --output hellofx

这将在hellofx目录中创建运行时映像

This creates the runtime image in hellofx directory

现在,我使用jpackage命令创建Windows安装程序.在目录中,我有一个应用程序图标.

Now i use the jpackage command to create the windows installer. In the directory i have an icon for the application.

jpackage --runtime-image hellofx --module hellofx/hellofx.HelloFX --win-shortcut --win-menu --icon smile.ico

此图标用于已安装的应用程序,但是是否可以为安装程序文件本身创建图标?名为HelloFX-1.0的安装程序文件没有图标.有没有一种方法可以将jpackage配置为也更改此文件的图标?感谢您的帮助!

This icon was used for the installed application but is there a way to create an icon for the installer file itself? The installer file named HelloFX-1.0 doesnt have an icon. Is there a way to configure jpackage to also change icon of this file? Thanks for the help!

推荐答案

在内部,jpackage工具使用特定于平台的工具来创建各种包类型.因此,包装的定制也是非常特定于平台的,必须针对每种受支持的平台和包装类型分别进行处理.但是,可以使用jpackage的两个常用功能来简化此任务.

Under the hood the jpackage tool uses platform-specific tooling to create the various package types. The customization of the packaging is therefore also very platform-specific and has to be handled individually for each supported platform and package type. However, there are two common features of jpackage that you can use to make this task easier.

第一个是选项--temp some_temp_dir,它要求jpackage将创建所选程序包类型所需的所有脚本和资源复制到some_temp_dir目录中.这些是jpackage默认使用的脚本和资源.

The first one is the option --temp some_temp_dir which asks jpackage to copy all scripts and resources needed to create the selected package type into a directory some_temp_dir. These are the scripts and resources that jpackage would use by default.

第二个是选项--resource-dir some_resource_dir,它要求jpackage首先在目录some_resource_dir中查找资源,然后将其默认值仅用于在目录中找不到的资源.

The second one is the option --resource-dir some_resource_dir which asks jpackage to first look for resources in the directory some_resource_dir and then use its defaults only for the ones it does not find there.

使用这两个选项,您可以首先生成一组默认资源,您可以从中选择要修改的资源并将其复制到目录some_resource_dir中.然后在第二次运行jpackage中,您可以应用这些更改.您可以通过这种方式进行的最可能的更改是将各种程序包类型使用的默认图标与您自己的图标交换.

With these two options you can first generate a set of default resources from which you can pick the ones you want to modify and copy them over to the directory some_resource_dir. In a second run of jpackage you can then apply these changes. The most likely changes you can make this way is to exchange the default icons, used by the various package types, with your own ones.

这篇关于有没有一种方法可以使用jpackage更改安装程序文件的图标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆