首页 > 解决方案 > 在 8u171/172 上使用 javapackager 创建的本机包包含更多文件

问题描述

我运行以下命令来为 .jar 文件创建本机包:

javapackager.exe -deploy -native image -srcfiles <files> -appclass <class> -outdir out -outfile test

使用 Java 8u171/172 的bundles/AppName/文件夹(包含用于启动 Java 应用程序的 .exe 和其他一些东西)包含以下 DLL 文件:

api-ms-win-core-console-l1-1-0.dll
api-ms-win-core-datetime-l1-1-0.dll
api-ms-win-core-debug-l1-1-0.dll
api-ms-win-core-errorhandling-l1-1-0.dll
api-ms-win-core-file-l1-1-0.dll
api-ms-win-core-file-l1-2-0.dll
api-ms-win-core-file-l2-1-0.dll
api-ms-win-core-handle-l1-1-0.dll
api-ms-win-core-heap-l1-1-0.dll
api-ms-win-core-interlocked-l1-1-0.dll
api-ms-win-core-libraryloader-l1-1-0.dll
api-ms-win-core-localization-l1-2-0.dll
api-ms-win-core-memory-l1-1-0.dll
api-ms-win-core-namedpipe-l1-1-0.dll
api-ms-win-core-processenvironment-l1-1-0.dll
api-ms-win-core-processthreads-l1-1-0.dll
api-ms-win-core-processthreads-l1-1-1.dll
api-ms-win-core-profile-l1-1-0.dll
api-ms-win-core-rtlsupport-l1-1-0.dll
api-ms-win-core-string-l1-1-0.dll
api-ms-win-core-synch-l1-1-0.dll
api-ms-win-core-synch-l1-2-0.dll
api-ms-win-core-sysinfo-l1-1-0.dll
api-ms-win-core-timezone-l1-1-0.dll
api-ms-win-core-util-l1-1-0.dll
api-ms-win-crt-conio-l1-1-0.dll
api-ms-win-crt-convert-l1-1-0.dll
api-ms-win-crt-environment-l1-1-0.dll
api-ms-win-crt-filesystem-l1-1-0.dll
api-ms-win-crt-heap-l1-1-0.dll
api-ms-win-crt-locale-l1-1-0.dll
api-ms-win-crt-math-l1-1-0.dll
api-ms-win-crt-multibyte-l1-1-0.dll
api-ms-win-crt-private-l1-1-0.dll
api-ms-win-crt-process-l1-1-0.dll
api-ms-win-crt-runtime-l1-1-0.dll
api-ms-win-crt-stdio-l1-1-0.dll
api-ms-win-crt-string-l1-1-0.dll
api-ms-win-crt-time-l1-1-0.dll
api-ms-win-crt-utility-l1-1-0.dll
msvcp140.dll
msvcr100.dll
packager.dll
ucrtbase.dll
vcruntime140.dll

其中大多数似乎也存在于runtime/bin/子文件夹中。

与此相反,使用 Java 8u161 运行相同的 javapackager 命令只会导致包含以下 DLL 文件(同样,除了 .exe 和其他内容之外):

msvcp140.dll
packager.dll
vcruntime140.dll

我认为 8u161 实际上缺少 msvcr100.dll (根据这个错误),但除此之外它似乎更合理。

我真的需要api-ms-win-*捆绑文件夹中的所有这些 DLL 吗?请注意,它们仍然可以在runtime/bin/包含的 JRE 使用的文件夹中使用,但不知何故,我无法想象它们对于 AppName.exe 的初始执行是必需的。

我发现这个 OpenJDK 提交似乎反映了这种变化。它修复了 8u161 中提到的问题,并且添加api-ms-win-*DLL 似乎是经过深思熟虑的。我仍然不相信所有这些都是必需的,尽管我没有充分的理由,除了它看起来很奇怪。没有它们,应用程序似乎运行良好,但我当然不能确定在任何情况下都会出现这种情况。

标签: javajavapackager

解决方案


推荐阅读