当前位置: 首页 > 知识库问答 >
问题:

甲骨文 JDK/Windows, JPackage 错误: 无效或不受支持的类型: [exe]

贾俊喆
2023-03-14

我正在尝试为java应用程序创建本机安装程序。我已经成功地在开放JDK / Linux上使用了jpackage,但现在我在Windows上的甲骨文JDK中。

我无法相信的是错误消息:为什么jpack声称“exe”是不受支持的类型,如果帮助页面只是将其列为允许的值之一?为什么输入除了“app-image”之外的任何内容都会导致失败?

我使用maven-antrun-plugin来执行这个ant代码片段:

        <target>
            <exec executable="jpackage" failonerror="true">
                <arg line="--version"/>
            </exec>
            <exec executable="jpackage" failonerror="true">
                <arg line="--help"/>
            </exec>
            <exec executable="jpackage" failonerror="true">
                <arg line="--input target/dist"/>
                <arg line="--main-jar ${project.artifactId}-${project.version}.jar"/>
                <arg line="--main-class ${mainclass}"/>
                <arg line="--dest target"/>
                <arg line="--name ${project.artifactId}"/>
                <arg line="--app-version ${project.version}"/>
                <arg line="--type exe"/>
                <arg line="--verbose"/>
            </exec>
        </target>

构建失败,输出如下(三个任务分开)。

 [exec] 16.0.1


 [exec] Usage: jpackage <options>
 [exec] 
 [exec] Sample usages:
 [exec] --------------
 [exec]     Generate an application package suitable for the host system:
 [exec]         For a modular application:
 [exec]             jpackage -n name -p modulePath -m moduleName/className
 [exec]         For a non-modular application:
 [exec]             jpackage -i inputDir -n name \
 [exec]                 --main-class className --main-jar myJar.jar
 [exec]         From a pre-built application image:
 [exec]             jpackage -n name --app-image appImageDir
 [exec]     Generate an application image:
 [exec]         For a modular application:
 [exec]             jpackage --type app-image -n name -p modulePath \
 [exec]                 -m moduleName/className
 [exec]         For a non-modular application:
 [exec]             jpackage --type app-image -i inputDir -n name \
 [exec]                 --main-class className --main-jar myJar.jar
 [exec]         To provide your own options to jlink, run jlink separately:
 [exec]             jlink --output appRuntimeImage -p modulePath -m moduleName \
 [exec]                 --no-header-files [<additional jlink options>...]
 [exec]             jpackage --type app-image -n name \
 [exec]                 -m moduleName/className --runtime-image appRuntimeImage
 [exec]     Generate a Java runtime package:
 [exec]         jpackage -n name --runtime-image <runtime-image>
 [exec] 
 [exec] Generic Options:
 [exec]   @<filename> 
 [exec]           Read options and/or mode from a file 
 [exec]           This option can be used multiple times.
 [exec]   --type -t <type> 
 [exec]           The type of package to create
 [exec]           Valid values are: {"app-image", "exe", "msi"} 
 [exec]           If this option is not specified a platform dependent
 [exec]           default type will be created.
 [exec]   --app-version <version>
 [exec]           Version of the application and/or package
 [exec]   --copyright <copyright string>
 [exec]           Copyright for the application
 [exec]   --description <description string>
 [exec]           Description of the application
 [exec]   --help -h 
 [exec]           Print the usage text with a list and description of each valid
 [exec]           option for the current platform to the output stream, and exit
 [exec]   --name -n <name>
 [exec]           Name of the application and/or package
 [exec]   --dest -d <destination path>
 [exec]           Path where generated output file is placed
 [exec]           Defaults to the current working directory.
 [exec]           (absolute path or relative to the current directory)
 [exec]   --temp <file path>
 [exec]           Path of a new or empty directory used to create temporary files
 [exec]           (absolute path or relative to the current directory)
 [exec]           If specified, the temp dir will not be removed upon the task
 [exec]           completion and must be removed manually
 [exec]           If not specified, a temporary directory will be created and
 [exec]           removed upon the task completion.
 [exec]   --vendor <vendor string>
 [exec]           Vendor of the application
 [exec]   --verbose
 [exec]           Enables verbose output
 [exec]   --version
 [exec]           Print the product version to the output stream and exit
 [exec] 
 [exec] Options for creating the runtime image:
 [exec]   --add-modules <module name>[,<module name>...]
 [exec]           A comma (",") separated list of modules to add.
 [exec]           This module list, along with the main module (if specified)
 [exec]           will be passed to jlink as the --add-module argument.
 [exec]           if not specified, either just the main module (if --module is
 [exec]           specified), or the default set of modules (if --main-jar is 
 [exec]           specified) are used.
 [exec]           This option can be used multiple times.
 [exec]   --module-path -p <module path>...
 [exec]           A ; separated list of paths
 [exec]           Each path is either a directory of modules or the path to a
 [exec]           modular jar.
 [exec]           (each path is absolute or relative to the current directory)
 [exec]           This option can be used multiple times.
 [exec]   --jlink-options <jlink options> 
 [exec]           A space separated list of options to pass to jlink 
 [exec]           If not specified, defaults to "--strip-native-commands 
 [exec]           --strip-debug --no-man-pages --no-header-files" 
 [exec]           This option can be used multiple times.
 [exec]   --runtime-image <file path>
 [exec]           Path of the predefined runtime image that will be copied into
 [exec]           the application image
 [exec]           (absolute path or relative to the current directory)
 [exec]           If --runtime-image is not specified, jpackage will run jlink to
 [exec]           create the runtime image using options:
 [exec]           --strip-debug, --no-header-files, --no-man-pages, and
 [exec]           --strip-native-commands.
 [exec] 
 [exec] Options for creating the application image:
 [exec]   --icon <icon file path>
 [exec]           Path of the icon of the application package
 [exec]           (absolute path or relative to the current directory)
 [exec]   --input -i <input path>
 [exec]           Path of the input directory that contains the files to be packaged
 [exec]           (absolute path or relative to the current directory)
 [exec]           All files in the input directory will be packaged into the
 [exec]           application image.
 [exec] 
 [exec] Options for creating the application launcher(s):
 [exec]   --add-launcher <launcher name>=<file path>
 [exec]           Name of launcher, and a path to a Properties file that contains
 [exec]           a list of key, value pairs
 [exec]           (absolute path or relative to the current directory)
 [exec]           The keys "module", "main-jar", "main-class",
 [exec]           "arguments", "java-options", "app-version", "icon", and
 [exec]           "win-console" can be used.
 [exec]           These options are added to, or used to overwrite, the original
 [exec]           command line options to build an additional alternative launcher.
 [exec]           The main application launcher will be built from the command line
 [exec]           options. Additional alternative launchers can be built using
 [exec]           this option, and this option can be used multiple times to
 [exec]           build multiple additional launchers. 
 [exec]   --arguments <main class arguments>
 [exec]           Command line arguments to pass to the main class if no command
 [exec]           line arguments are given to the launcher
 [exec]           This option can be used multiple times.
 [exec]   --java-options <java options>
 [exec]           Options to pass to the Java runtime
 [exec]           This option can be used multiple times.
 [exec]   --main-class <class name>
 [exec]           Qualified name of the application main class to execute
 [exec]           This option can only be used if --main-jar is specified.
 [exec]   --main-jar <main jar file>
 [exec]           The main JAR of the application; containing the main class
 [exec]           (specified as a path relative to the input path)
 [exec]           Either --module or --main-jar option can be specified but not
 [exec]           both.
 [exec]   --module -m <module name>[/<main class>]
 [exec]           The main module (and optionally main class) of the application
 [exec]           This module must be located on the module path.
 [exec]           When this option is specified, the main module will be linked
 [exec]           in the Java runtime image.  Either --module or --main-jar
 [exec]           option can be specified but not both.
 [exec] 
 [exec] Platform dependent option for creating the application launcher:
 [exec]   --win-console
 [exec]           Creates a console launcher for the application, should be
 [exec]           specified for application which requires console interactions
 [exec] 
 [exec] Options for creating the application package:
 [exec]   --app-image <file path>
 [exec]           Location of the predefined application image that is used
 [exec]           to build an installable package
 [exec]           (absolute path or relative to the current directory)
 [exec]   --file-associations <file path>
 [exec]           Path to a Properties file that contains list of key, value pairs
 [exec]           (absolute path or relative to the current directory)
 [exec]           The keys "extension", "mime-type", "icon", and "description"
 [exec]           can be used to describe the association.
 [exec]           This option can be used multiple times.
 [exec]   --install-dir <file path>
 [exec]           Relative sub-path under the default installation location
 [exec]   --license-file <file path>
 [exec]           Path to the license file
 [exec]           (absolute path or relative to the current directory)
 [exec]   --resource-dir <path>
 [exec]           Path to override jpackage resources
 [exec]           Icons, template files, and other resources of jpackage can be
 [exec]           over-ridden by adding replacement resources to this directory.
 [exec]           (absolute path or relative to the current directory)
 [exec]   --runtime-image <file-path>
 [exec]           Path of the predefined runtime image to install
 [exec]           (absolute path or relative to the current directory)
 [exec]           Option is required when creating a runtime package.
 [exec] 
 [exec] Platform dependent options for creating the application package:
 [exec]   --win-dir-chooser
 [exec]           Adds a dialog to enable the user to choose a directory in which
 [exec]           the product is installed
 [exec]   --win-menu
 [exec]           Adds the application to the system menu
 [exec]   --win-menu-group <menu group name>
 [exec]           Start Menu group this application is placed in
 [exec]   --win-per-user-install
 [exec]           Request to perform an install on a per-user basis
 [exec]   --win-shortcut
 [exec]           Creates a desktop shortcut for the application
 [exec]   --win-upgrade-uuid <id string>
 [exec]           UUID associated with upgrades for this package


 [exec] [22:46:46.538] Can not find WiX tools (light.exe, candle.exe)
 [exec] [22:46:46.529] Running candle.exe
 [exec] [22:46:46.538] Download WiX 3.0 or later from https://wixtoolset.org and add it to the PATH.
 [exec] [22:46:46.539] jdk.jpackage.internal.PackagerException: Error: Invalid or unsupported type: [exe]
 [exec]     at jdk.jpackage/jdk.jpackage.internal.Arguments.generateBundle(Arguments.java:658)
 [exec]     at jdk.jpackage/jdk.jpackage.internal.Arguments.processArguments(Arguments.java:538)
 [exec]     at jdk.jpackage/jdk.jpackage.main.Main.execute(Main.java:98)
 [exec]     at jdk.jpackage/jdk.jpackage.main.Main.main(Main.java:52)

那么为什么我会收到这个错误呢?我该如何解决?

共有1个答案

乔伯寅
2023-03-14

因此,似乎误导性错误消息的解决方案错误:无效或不受支持的类型:[exe]一直显示在屏幕上:

[exec] [22:46:46.538] Can not find WiX tools (light.exe, candle.exe)
[exec] [22:46:46.529] Running candle.exe
[exec] [22:46:46.538] Download WiX 3.0 or later from https://wixtoolset.org and
add it to the PATH.

在做了这些之后,jpackage现在的表现好多了。

 类似资料:
  • Android studio曾经抱怨使用OpenJDK,并推荐Oracle JDK。然而,在最新的Android Studio中,这个提示消失了(可能是由于两家公司之间的法律纠纷)。 我今天安装了甲骨文1.8.0.92 JDK和Android Studio 2.1.1似乎运行速度更快,明显更快。 你知道Android studio在Java 1.8和OpenJDK与Oracle JDK方面的现状吗

  • Support for the Oracle database. The following table summarizes current support levels for database release versions. 支持的Oracle版本 The following dialect/DBAPI options are available. Please refer to ind

  • 问题内容: 我似乎无法弄清楚我的代码出了什么问题,但是我不断得到: 这是我的代码: 当我在查询中将’ ‘而不是设置为变量时,它可以正常工作,因此我知道这是元组语法或其他问题。我已经试过了,没有括号,有第二个变量,有没有单独定义的游标,基本上我能想到的每种方法,我已经研究了数小时,但是却一无所获,所以任何帮助都是超级有用的赞赏。 问题答案: 嵌套列表,元组用于,而不用于。 传递包含参数的平面列表(或

  • 我刚接触oracle forms,遇到了一个问题。我在表单中有两个具有相同字段的多个记录块。 我查询一个块的数据,它被填充。 哪里有一种方法可以将所有行从填充的块复制到“复制”块?

  • 我正在开发基本的Spring Boot应用程序,它启用了Spring Security性 当我尝试在my thymeleaf HTML中使用CSS时,出现以下错误: 拒绝应用http://localhost:9999/login的样式,因为它的MIME类型(text/html)不是受支持的样式表MIME类型,并且启用了严格的MIME检查。