使用javapackager将图标添加到包中 [英] adding icon to bundle using javapackager
问题描述
我正在使用javapackager创建一个使用命令行捆绑jre的exe安装程序。
是否有人知道如何添加图标并使用命令自定义安装程序这是我使用的命令:
javapackager -deploy -native -outdir packages -outfile myFile
-srcdir documents -srcfiles Application.jar -appclass application.Main
-nameApplication-titleApplication Title
我试图添加license =info和其他一些命令
记录,使用选项 icon
,前缀为 -B
,以使用自定义图标:
-Bicon = app.ico
或者将图标文件放在 package / windows / appName.ico
。
以下是生成EXE设置文件的完整示例:
先决条件:
- 这仅适用于Windows。
- 您需要从 http://www.jrsoftware.org 安装Inno Setup 5或更高版本并将其添加到PATH 。
命令:
javapackager -deploy -native exe -Bruntime =C:\Program Files \ Java @\\\\\ = true -BshortcutHint = true -outdir packages -outfile appFile -srcdir dist -srcfiles MyApp.jar; COPYING.txt -appclass somePackage.MainClass -BlicenseFile = COPYING.txt -name appName -title应用程序名称
- javapackager:这是Java打包工具,位于
%JDK_HOME%\bin\javapackager.exe
。 - -deploy -native exe :生成Windows .exe安装程序。
- -Bruntime :要包含在软件包中的JRE的位置。
- -Bicon :要使用的.ico文件的路径作为安装程序文件图标。
- -BsystemWide :指示应用程序是安装在Program Files中还是安装在用户主目录中的标准位置的标志。设置为true以在Program Files中安装应用程序。设置为false以将应用程序安装在用户的主目录中。默认值为false。
- -BshortcutHint :指示是否在桌面上放置快捷方式的标志。设置为true以向桌面添加快捷方式。默认值为false。
-
-BlicenseFile :包含将在开始安装后显示的许可协议的文本文件。此文件应位于
srcdir
内,并列在srcfiles
中。
- 请注意,此示例中的
MyApp.jar
和COPYING.txt
位于./ dist /
文件夹(与-srcdir一起指定)。MyApp.jar
是一个可执行的jar文件。
- 请注意,此示例中的
EXTRA:
- 您可以添加以下内容来自定义安装程序对话框的徽标以下文件( max-size = 55x58像素):
package / windows / appName-setup-icon.bmp
- 还检测到以下文件:
package / windows / appName.iss(Inno安装项目文件)
package / windows / appName-post-image.wsf(填充应用程序映像后运行的脚本)
- 使用详细选项
-v
在执行javapackager
时查看更多详细信息。在javapackager
完成后,它将打印如下消息:
配置文件保存到C:\ Users \Fouad \ AppData \ Local \Temp \ fxbundler3314360063389283581 \ windows。使用它们来自定义包。
您将在该文件夹中找到以下有用文件:
- appName.ico
- appName.iss
- appName-setup-icon.bmp
更多信息:
i am using javapackager to create an exe installer with jre bundled using the command line.
does anybody know how to add an icon and customise the installer using the command line.
these are the commands that i use:
javapackager -deploy -native -outdir packages -outfile myFile
-srcdir documents -srcfiles Application.jar -appclass application.Main
-name "Application" -title "Application Title"
i have tried to add license="info" and some other commands
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 withinsrcfiles
.- Note that
MyApp.jar
andCOPYING.txt
in this example are located at./dist/
folder (as specified with -srcdir).MyApp.jar
is an executable jar file.
- Note that
EXTRA:
- You can customize the logo of the installer dialog by adding the following file (max-size = 55x58 pixels):
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 whilejavapackager
is executed. Afterjavapackager
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:
这篇关于使用javapackager将图标添加到包中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!