adding icon to bundle using javapackager

老子叫甜甜 提交于 2019-12-05 09:56:45

As documented, use the option icon with the prefix -B to use a custom icon:

-Bicon=app.ico

or alternatively put the icon file at package/windows/appName.ico.


Here is a complete example for generating an EXE setup file:

PREREQUISITES:

  • This will work on Windows only.
  • You need to install Inno Setup 5 or newer from http://www.jrsoftware.org and add it to the PATH.

COMMAND:

javapackager -deploy -native exe -Bruntime="C:\Program Files\Java\jdk1.8.0_66\jre" -Bicon=app_icon.ico -BsystemWide=true -BshortcutHint=true -outdir packages -outfile appFile -srcdir dist -srcfiles MyApp.jar;COPYING.txt -appclass somePackage.MainClass -BlicenseFile=COPYING.txt -name appName -title "The application name"

  • javapackager: this is the Java packager tool, which is located at %JDK_HOME%\bin\javapackager.exe.
  • -deploy -native exe : Generates a Windows .exe installer.
  • -Bruntime: Location of the JRE to include in the package bundle.
  • -Bicon: Path of the .ico file to be used as installer file icon.
  • -BsystemWide: Flag that indicates if the application is installed in Program Files or in the standard location in the users home directory. Set to true to install the application in Program Files. Set to false to install the application in the user's home directory. The default is false.
  • -BshortcutHint: Flag that indicates if a shortcut is placed on the desktop. Set to true to add a shortcut to the desktop. The default is false.
  • -BlicenseFile: Text file that contains the license agreement which will be shown after starting the installation. This file should be inside srcdir and listed within srcfiles.

    • Note that MyApp.jar and COPYING.txt in this example are located at ./dist/ folder (as specified with -srcdir). MyApp.jar is an executable jar file.

EXTRA:

package/windows/appName-setup-icon.bmp
  • The following files are detected as well:
package/windows/appName.iss (Inno Setup project file)
package/windows/appName-post-image.wsf (script to run after application image is populated)
  • Use the verbose option -v to see more details while javapackager is executed. After javapackager completes, it will print a message like this:

Config files are saved to C:\Users\Fouad\AppData\Local\Temp\fxbundler3314360063389283581\windows. Use them to customize package.

You will find the following useful files in that folder:

  • appName.ico
  • appName.iss
  • appName-setup-icon.bmp

For more:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!