Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is there a way to change icon of the installer file using jpackage?

I have a simple modular javafx application.

i compile it using

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

This creates mods directory

I then create runtime image using the command

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

This creates the runtime image in hellofx directory

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

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!

enter image description here

like image 690
kofhearts Avatar asked Jun 06 '20 05:06

kofhearts


People also ask

How do I use jpackage tool?

See jpackage Options. The jpackage tool will take as input a Java application and a Java run-time image, and produce a Java application image that includes all the necessary dependencies. It will be able to produce a native package in a platform-specific format, such as an exe on Windows or a dmg on macOS.

How do I override a jpackage resource?

--resource-dir <path> Path to override jpackage resources (absolute path or relative to the current directory). Icons, template files, and other resources of jpackage can be over-ridden by adding replacement resources to this directory.

What is -- runtime-image in jpackage?

--runtime-image <file paths> Path of the predefined runtime image that will be copied into the application image (absolute path or relative to the current directory). If --runtime-image is not specified, jpackage will run jlink to create the runtime image using options: --strip-debug, --no-header-files, --no-man-pages, and --strip-native-commands.

How to change default icon of ZIP file in Windows 10?

Just extract the ZIP file and execute the application. In the main home screen, you will see all the file types in your system. 2. In the application, find the file type you are looking for, right-click on it and select “Edit Selected File Type” option. 3. Here, click on the “…” button next to the Default Icon field.


Video Answer


1 Answers

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.

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.

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.

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.

like image 151
mipa Avatar answered Oct 22 '22 22:10

mipa