JPackage 不生成工作 exe 和错误文件夹

JPackage doesn't generate working exe and bugs folders

我正在尝试使用 JPackage 从我的 jar 应用程序制作一个可移植的 exe。我使用 jdk16 和 maven 来制作应用程序,应用程序可以完美地编译和运行。当我尝试使用 JPackage 时发生了一些奇怪的事情,当使用 -t exe 时,我有时会得到一个 exe 安装程序,它在执行时只播放 windows 错误声音,有时关闭其他人不得不使用任务管理器,其他时候生成没有什么。然后我尝试使用 -t app-image(据我所知,创建可移植 exe 文件所需的那个),现在 JPackage 从未停止运行,只是创建了文件夹和文件夹。此时我创建了一个新项目,我将使用这个项目来更详细地解释我的问题,因为它创建了相同的问题。

package test;

import javax.swing.JFrame;
import javax.swing.JLabel;

public class Main {

    public static void main(String[] args) {
        JFrame frame = new JFrame();
        frame.add(new JLabel("Hello world!"));
        frame.pack();
        frame.setVisible(true);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }

}

这是该测试项目包含的所有代码。我导出它并将最终的 jar 移到它自己的文件夹中,并在包含 jar 和“temp”文件夹的文件夹上运行以下命令

jpackage -t app-image -n "Test" --temp "temp" --verbose -i "" --main-class "test.Main" --main-jar "Test.jar" --win-console

虽然指定了 --verbose,但直到几分钟后我才在控制台中显示任何内容

[00:29:39.141] Creating app package: Test in C:\Users\mynem\Desktop\Nueva carpeta\test jpackage 3
[00:29:44.060] Command [PID: -1]:
    jlink --output C:\Users\mynem\Desktop\Nueva carpeta\test jpackage 3\Test\runtime --module-path C:\Program Files\Java\jdk-17\jmods --add-modules jdk.management.jfr,java.rmi,jdk.jdi,jdk.charsets,jdk.xml.dom,java.xml,java.datatransfer,jdk.jstatd,jdk.httpserver,java.desktop,java.security.sasl,jdk.zipfs,java.base,jdk.crypto.ec,jdk.javadoc,jdk.management.agent,jdk.jshell,jdk.editpad,java.sql.rowset,jdk.sctp,jdk.jsobject,java.smartcardio,jdk.jlink,jdk.unsupported,java.security.jgss,java.compiler,jdk.nio.mapmode,jdk.dynalink,jdk.unsupported.desktop,jdk.accessibility,jdk.security.jgss,java.sql,jdk.incubator.vector,java.transaction.xa,java.xml.crypto,java.logging,jdk.jfr,jdk.crypto.cryptoki,jdk.net,jdk.random,java.naming,jdk.internal.ed,java.prefs,java.net.http,jdk.compiler,jdk.naming.rmi,jdk.internal.opt,jdk.jconsole,jdk.attach,jdk.crypto.mscapi,jdk.internal.le,java.management,jdk.jdwp.agent,jdk.internal.jvmstat,jdk.incubator.foreign,java.instrument,jdk.management,jdk.security.auth,java.scripting,jdk.jdeps,jdk.jartool,java.management.rmi,jdk.jpackage,jdk.naming.dns,jdk.localedata --strip-native-commands --strip-debug --no-man-pages --no-header-files
[00:29:44.060] Output:
    WARNING: Using incubator modules: jdk.incubator.vector, jdk.incubator.foreign

[00:29:44.061] Returned: 0

[00:29:44.064] Using default package resource JavaApp.ico [icon] (add Test.ico to the resource-dir to customize).
[00:29:44.071] Warning: Windows Defender may prevent jpackage from functioning. If there is an issue, it can be addressed by either disabling realtime monitoring, or adding an exclusion for the directory "C:\Users\mynem\Desktop\Nueva carpeta\test jpackage 3\temp".
[00:29:44.781] Using default package resource WinLauncher.template [Template for creating executable properties file] (add Test.properties to the resource-dir to customize).
[00:33:43.032] java.io.IOException: Cannot access file with path exceeding 32000 characters
        at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:81)
        at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
        at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
        at java.base/sun.nio.fs.WindowsFileSystemProvider.createDirectory(WindowsFileSystemProvider.java:521)
        at java.base/java.nio.file.Files.createDirectory(Files.java:700)
        at java.base/java.nio.file.Files.createAndCheckIsDirectory(Files.java:807)
        at java.base/java.nio.file.Files.createDirectories(Files.java:793)
        at jdk.jpackage/jdk.jpackage.internal.IOUtils.preVisitDirectory(IOUtils.java:119)
        at jdk.jpackage/jdk.jpackage.internal.IOUtils.preVisitDirectory(IOUtils.java:112)
        at java.base/java.nio.file.Files.walkFileTree(Files.java:2817)
        at java.base/java.nio.file.Files.walkFileTree(Files.java:2882)
        at jdk.jpackage/jdk.jpackage.internal.IOUtils.copyRecursive(IOUtils.java:112)
        at jdk.jpackage/jdk.jpackage.internal.IOUtils.copyRecursive(IOUtils.java:107)
        at jdk.jpackage/jdk.jpackage.internal.AbstractAppImageBuilder.copyApplication(AbstractAppImageBuilder.java:74)
        at jdk.jpackage/jdk.jpackage.internal.WindowsAppImageBuilder.prepareApplicationFiles(WindowsAppImageBuilder.java:103)
        at jdk.jpackage/jdk.jpackage.internal.AppImageBundler.createAppBundle(AppImageBundler.java:172)
        at jdk.jpackage/jdk.jpackage.internal.AppImageBundler.execute(AppImageBundler.java:91)
        at jdk.jpackage/jdk.jpackage.internal.Arguments.generateBundle(Arguments.java:676)
        at jdk.jpackage/jdk.jpackage.internal.Arguments.processArguments(Arguments.java:550)
        at jdk.jpackage/jdk.jpackage.main.Main.execute(Main.java:91)
        at jdk.jpackage/jdk.jpackage.main.Main.main(Main.java:52)
[00:33:43.034] Kept working directory for debug: C:\Users\mynem\Desktop\Nueva carpeta\test jpackage 3\temp
[00:33:43.034] jdk.jpackage.internal.PackagerException: java.io.IOException: Cannot access file with path exceeding 32000 characters
        at jdk.jpackage/jdk.jpackage.internal.AppImageBundler.execute(AppImageBundler.java:96)
        at jdk.jpackage/jdk.jpackage.internal.Arguments.generateBundle(Arguments.java:676)
        at jdk.jpackage/jdk.jpackage.internal.Arguments.processArguments(Arguments.java:550)
        at jdk.jpackage/jdk.jpackage.main.Main.execute(Main.java:91)
        at jdk.jpackage/jdk.jpackage.main.Main.main(Main.java:52)
Caused by: java.io.IOException: Cannot access file with path exceeding 32000 characters
        at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:81)
        at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
        at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
        at java.base/sun.nio.fs.WindowsFileSystemProvider.createDirectory(WindowsFileSystemProvider.java:521)
        at java.base/java.nio.file.Files.createDirectory(Files.java:700)
        at java.base/java.nio.file.Files.createAndCheckIsDirectory(Files.java:807)
        at java.base/java.nio.file.Files.createDirectories(Files.java:793)
        at jdk.jpackage/jdk.jpackage.internal.IOUtils.preVisitDirectory(IOUtils.java:119)
        at jdk.jpackage/jdk.jpackage.internal.IOUtils.preVisitDirectory(IOUtils.java:112)
        at java.base/java.nio.file.Files.walkFileTree(Files.java:2817)
        at java.base/java.nio.file.Files.walkFileTree(Files.java:2882)
        at jdk.jpackage/jdk.jpackage.internal.IOUtils.copyRecursive(IOUtils.java:112)
        at jdk.jpackage/jdk.jpackage.internal.IOUtils.copyRecursive(IOUtils.java:107)
        at jdk.jpackage/jdk.jpackage.internal.AbstractAppImageBuilder.copyApplication(AbstractAppImageBuilder.java:74)
        at jdk.jpackage/jdk.jpackage.internal.WindowsAppImageBuilder.prepareApplicationFiles(WindowsAppImageBuilder.java:103)
        at jdk.jpackage/jdk.jpackage.internal.AppImageBundler.createAppBundle(AppImageBundler.java:172)
        at jdk.jpackage/jdk.jpackage.internal.AppImageBundler.execute(AppImageBundler.java:91)
        ... 4 more

我知道消息中说它使用的是 jdk17,但我也尝试过使用 16 遇到同样的问题。我想 JPackage 崩溃的唯一原因是文件夹的路径太长了,因为现在我开始的文件夹看起来像这样

├───temp
└───Test
    ├───app
    │   ├───temp
    │   └───Test
    │       └───app
    │           ├───temp
    │           └───Test
    │               └───app
    │                   ├───temp
    │                   └───Test
    │                       └───app
    │                           ├───temp
    │                           └───Test
    │                               └───app
    │                                   ├───temp
    │                                   └───Test
    │                                                                                       
    └───runtime
        ├───bin
        │   └───server
        ├───conf
        │   ├───management
        │   └───security
        │       └───policy
        │           ├───limited
        │           └───unlimited
        ├───legal
        │   ├───java.base
        │   ├───java.compiler
        │   ├───java.datatransfer
        │   ├───java.desktop
        │   ├───java.instrument
        │   ├───java.logging
        │   ├───java.management
        │   ├───java.management.rmi
        │   ├───java.naming
        │   ├───java.net.http
        │   ├───java.prefs
        │   ├───java.rmi
        │   ├───java.scripting
        │   ├───java.security.jgss
        │   ├───java.security.sasl
        │   ├───java.smartcardio
        │   ├───java.sql
        │   ├───java.sql.rowset
        │   ├───java.transaction.xa
        │   ├───java.xml
        │   ├───java.xml.crypto
        │   ├───jdk.accessibility
        │   ├───jdk.attach
        │   ├───jdk.charsets
        │   ├───jdk.compiler
        │   ├───jdk.crypto.cryptoki
        │   ├───jdk.crypto.ec
        │   ├───jdk.crypto.mscapi
        │   ├───jdk.dynalink
        │   ├───jdk.editpad
        │   ├───jdk.httpserver
        │   ├───jdk.incubator.foreign
        │   ├───jdk.incubator.vector
        │   ├───jdk.internal.ed
        │   ├───jdk.internal.jvmstat
        │   ├───jdk.internal.le
        │   ├───jdk.internal.opt
        │   ├───jdk.jartool
        │   ├───jdk.javadoc
        │   ├───jdk.jconsole
        │   ├───jdk.jdeps
        │   ├───jdk.jdi
        │   ├───jdk.jdwp.agent
        │   ├───jdk.jfr
        │   ├───jdk.jlink
        │   ├───jdk.jpackage
        │   ├───jdk.jshell
        │   ├───jdk.jsobject
        │   ├───jdk.jstatd
        │   ├───jdk.localedata
        │   ├───jdk.management
        │   ├───jdk.management.agent
        │   ├───jdk.management.jfr
        │   ├───jdk.naming.dns
        │   ├───jdk.naming.rmi
        │   ├───jdk.net
        │   ├───jdk.nio.mapmode
        │   ├───jdk.random
        │   ├───jdk.sctp
        │   ├───jdk.security.auth
        │   ├───jdk.security.jgss
        │   ├───jdk.unsupported
        │   ├───jdk.unsupported.desktop
        │   ├───jdk.xml.dom
        │   └───jdk.zipfs
        └───lib
            ├───jfr
            └───security

“测试应用程序”bucle 似乎没有结束,我缩短了它,因为我达到了 post 的字符限制。此外,如果我现在尝试删除顶部的“测试”文件夹,我会得到 Error 0x80070091: The folder is not empty. 并且我无法删除它,因为按下重试按钮会使 windows 资源管理器重新启动而不删除该文件夹,所以现在我有一大堆我无法从我的所有测试中删除的文件夹(关于如何删除它们的帮助也很受欢迎)。

然后我再次将 jar 文件移动到它自己的文件夹并创建了临时文件夹,运行 命令

jpackage -t exe -n "Test" --temp "temp" --verbose -i "" --main-class "test.Main" --main-jar "Test.jar" --win-console

(将 -t app-image 更改为 -t exe)再次,直到几分钟在控制台上没有任何内容,然后

[00:43:45.791] Running candle.exe
[00:43:45.833] Running C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe
[00:43:46.193] Running light.exe
[00:43:46.223] Running C:\Program Files (x86)\WiX Toolset v3.11\bin\light.exe
[00:43:46.407] Detected [light.exe] version [3.11.2.4516].
[00:43:46.407] Detected [candle.exe] version [3.11.2.4516].
[00:43:46.408] WiX 3.11.2.4516 detected. Enabling advanced cleanup action.
[00:43:51.431] Command [PID: -1]:
    jlink --output temp\images\win-msi.image\Test\runtime --module-path C:\Program Files\Java\jdk-17\jmods --add-modules java.rmi,jdk.management.jfr,jdk.jdi,jdk.charsets,jdk.xml.dom,java.xml,java.datatransfer,jdk.jstatd,jdk.httpserver,java.desktop,java.security.sasl,jdk.zipfs,java.base,jdk.crypto.ec,jdk.javadoc,jdk.management.agent,jdk.jshell,jdk.editpad,jdk.sctp,java.sql.rowset,jdk.jsobject,jdk.unsupported,jdk.jlink,java.smartcardio,java.security.jgss,java.compiler,jdk.nio.mapmode,jdk.dynalink,jdk.unsupported.desktop,jdk.accessibility,jdk.security.jgss,jdk.incubator.vector,java.sql,java.xml.crypto,java.transaction.xa,java.logging,jdk.jfr,jdk.crypto.cryptoki,jdk.net,jdk.random,java.naming,jdk.internal.ed,java.prefs,java.net.http,jdk.compiler,jdk.internal.opt,jdk.naming.rmi,jdk.jconsole,jdk.attach,jdk.crypto.mscapi,jdk.internal.le,java.management,jdk.jdwp.agent,jdk.internal.jvmstat,jdk.incubator.foreign,java.instrument,jdk.management,jdk.security.auth,java.scripting,jdk.jdeps,jdk.jartool,java.management.rmi,jdk.jpackage,jdk.naming.dns,jdk.localedata --strip-native-commands --strip-debug --no-man-pages --no-header-files
[00:43:51.431] Output:
    WARNING: Using incubator modules: jdk.incubator.foreign, jdk.incubator.vector

[00:43:51.432] Returned: 0

[00:43:51.435] Using default package resource JavaApp.ico [icon] (add Test.ico to the resource-dir to customize).
[00:43:51.442] Warning: Windows Defender may prevent jpackage from functioning. If there is an issue, it can be addressed by either disabling realtime monitoring, or adding an exclusion for the directory "C:\Users\mynem\Desktop\Nueva carpeta\test jpackage 4\temp".
[00:43:51.532] Using default package resource WinLauncher.template [Template for creating executable properties file] (add Test.properties to the resource-dir to customize).
[00:44:56.974] java.io.IOException: Cannot access file with path exceeding 32000 characters
        at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:81)
        at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
        at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
        at java.base/sun.nio.fs.WindowsFileSystemProvider.createDirectory(WindowsFileSystemProvider.java:521)
        at java.base/java.nio.file.Files.createDirectory(Files.java:700)
        at java.base/java.nio.file.Files.createAndCheckIsDirectory(Files.java:807)
        at java.base/java.nio.file.Files.createDirectories(Files.java:793)
        at jdk.jpackage/jdk.jpackage.internal.IOUtils.preVisitDirectory(IOUtils.java:119)
        at jdk.jpackage/jdk.jpackage.internal.IOUtils.preVisitDirectory(IOUtils.java:112)
        at java.base/java.nio.file.Files.walkFileTree(Files.java:2817)
        at java.base/java.nio.file.Files.walkFileTree(Files.java:2882)
        at jdk.jpackage/jdk.jpackage.internal.IOUtils.copyRecursive(IOUtils.java:112)
        at jdk.jpackage/jdk.jpackage.internal.IOUtils.copyRecursive(IOUtils.java:107)
        at jdk.jpackage/jdk.jpackage.internal.AbstractAppImageBuilder.copyApplication(AbstractAppImageBuilder.java:74)
        at jdk.jpackage/jdk.jpackage.internal.WindowsAppImageBuilder.prepareApplicationFiles(WindowsAppImageBuilder.java:103)
        at jdk.jpackage/jdk.jpackage.internal.AppImageBundler.createAppBundle(AppImageBundler.java:172)
        at jdk.jpackage/jdk.jpackage.internal.AppImageBundler.execute(AppImageBundler.java:91)
        at jdk.jpackage/jdk.jpackage.internal.WinMsiBundler.prepareProto(WinMsiBundler.java:351)
        at jdk.jpackage/jdk.jpackage.internal.WinMsiBundler.execute(WinMsiBundler.java:399)
        at jdk.jpackage/jdk.jpackage.internal.WinExeBundler.bundle(WinExeBundler.java:104)
        at jdk.jpackage/jdk.jpackage.internal.WinExeBundler.execute(WinExeBundler.java:77)
        at jdk.jpackage/jdk.jpackage.internal.Arguments.generateBundle(Arguments.java:676)
        at jdk.jpackage/jdk.jpackage.internal.Arguments.processArguments(Arguments.java:550)
        at jdk.jpackage/jdk.jpackage.main.Main.execute(Main.java:91)
        at jdk.jpackage/jdk.jpackage.main.Main.main(Main.java:52)
[00:44:56.975] Kept working directory for debug: C:\Users\mynem\Desktop\Nueva carpeta\test jpackage 4\temp
[00:44:56.975] jdk.jpackage.internal.PackagerException: java.io.IOException: Cannot access file with path exceeding 32000 characters
        at jdk.jpackage/jdk.jpackage.internal.AppImageBundler.execute(AppImageBundler.java:96)
        at jdk.jpackage/jdk.jpackage.internal.WinMsiBundler.prepareProto(WinMsiBundler.java:351)
        at jdk.jpackage/jdk.jpackage.internal.WinMsiBundler.execute(WinMsiBundler.java:399)
        at jdk.jpackage/jdk.jpackage.internal.WinExeBundler.bundle(WinExeBundler.java:104)
        at jdk.jpackage/jdk.jpackage.internal.WinExeBundler.execute(WinExeBundler.java:77)
        at jdk.jpackage/jdk.jpackage.internal.Arguments.generateBundle(Arguments.java:676)
        at jdk.jpackage/jdk.jpackage.internal.Arguments.processArguments(Arguments.java:550)
        at jdk.jpackage/jdk.jpackage.main.Main.execute(Main.java:91)
        at jdk.jpackage/jdk.jpackage.main.Main.main(Main.java:52)
Caused by: java.io.IOException: Cannot access file with path exceeding 32000 characters
        at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:81)
        at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
        at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
        at java.base/sun.nio.fs.WindowsFileSystemProvider.createDirectory(WindowsFileSystemProvider.java:521)
        at java.base/java.nio.file.Files.createDirectory(Files.java:700)
        at java.base/java.nio.file.Files.createAndCheckIsDirectory(Files.java:807)
        at java.base/java.nio.file.Files.createDirectories(Files.java:793)
        at jdk.jpackage/jdk.jpackage.internal.IOUtils.preVisitDirectory(IOUtils.java:119)
        at jdk.jpackage/jdk.jpackage.internal.IOUtils.preVisitDirectory(IOUtils.java:112)
        at java.base/java.nio.file.Files.walkFileTree(Files.java:2817)
        at java.base/java.nio.file.Files.walkFileTree(Files.java:2882)
        at jdk.jpackage/jdk.jpackage.internal.IOUtils.copyRecursive(IOUtils.java:112)
        at jdk.jpackage/jdk.jpackage.internal.IOUtils.copyRecursive(IOUtils.java:107)
        at jdk.jpackage/jdk.jpackage.internal.AbstractAppImageBuilder.copyApplication(AbstractAppImageBuilder.java:74)
        at jdk.jpackage/jdk.jpackage.internal.WindowsAppImageBuilder.prepareApplicationFiles(WindowsAppImageBuilder.java:103)
        at jdk.jpackage/jdk.jpackage.internal.AppImageBundler.createAppBundle(AppImageBundler.java:172)
        at jdk.jpackage/jdk.jpackage.internal.AppImageBundler.execute(AppImageBundler.java:91)
        ... 8 more

文件夹现在看起来像这样

└───temp
    └───images
        ├───win-exe.image
        └───win-msi.image
            └───Test
                ├───app
                │   └───temp
                │       └───images
                │           ├───win-exe.image
                │           └───win-msi.image
                │               └───Test
                │                   └───app
                │                       └───temp
                │                           └───images
                │                               ├───win-exe.image
                │                               └───win-msi.image
                └───runtime
                    ├───bin
                    │   └───server
                    ├───conf
                    │   ├───management
                    │   └───security
                    │       └───policy
                    │           ├───limited
                    │           └───unlimited
                    ├───legal
                    │   ├───java.base
                    │   ├───java.compiler
                    │   ├───java.datatransfer
                    │   ├───java.desktop
                    │   ├───java.instrument
                    │   ├───java.logging
                    │   ├───java.management
                    │   ├───java.management.rmi
                    │   ├───java.naming
                    │   ├───java.net.http
                    │   ├───java.prefs
                    │   ├───java.rmi
                    │   ├───java.scripting
                    │   ├───java.security.jgss
                    │   ├───java.security.sasl
                    │   ├───java.smartcardio
                    │   ├───java.sql
                    │   ├───java.sql.rowset
                    │   ├───java.transaction.xa
                    │   ├───java.xml
                    │   ├───java.xml.crypto
                    │   ├───jdk.accessibility
                    │   ├───jdk.attach
                    │   ├───jdk.charsets
                    │   ├───jdk.compiler
                    │   ├───jdk.crypto.cryptoki
                    │   ├───jdk.crypto.ec
                    │   ├───jdk.crypto.mscapi
                    │   ├───jdk.dynalink
                    │   ├───jdk.editpad
                    │   ├───jdk.httpserver
                    │   ├───jdk.incubator.foreign
                    │   ├───jdk.incubator.vector
                    │   ├───jdk.internal.ed
                    │   ├───jdk.internal.jvmstat
                    │   ├───jdk.internal.le
                    │   ├───jdk.internal.opt
                    │   ├───jdk.jartool
                    │   ├───jdk.javadoc
                    │   ├───jdk.jconsole
                    │   ├───jdk.jdeps
                    │   ├───jdk.jdi
                    │   ├───jdk.jdwp.agent
                    │   ├───jdk.jfr
                    │   ├───jdk.jlink
                    │   ├───jdk.jpackage
                    │   ├───jdk.jshell
                    │   ├───jdk.jsobject
                    │   ├───jdk.jstatd
                    │   ├───jdk.localedata
                    │   ├───jdk.management
                    │   ├───jdk.management.agent
                    │   ├───jdk.management.jfr
                    │   ├───jdk.naming.dns
                    │   ├───jdk.naming.rmi
                    │   ├───jdk.net
                    │   ├───jdk.nio.mapmode
                    │   ├───jdk.random
                    │   ├───jdk.sctp
                    │   ├───jdk.security.auth
                    │   ├───jdk.security.jgss
                    │   ├───jdk.unsupported
                    │   ├───jdk.unsupported.desktop
                    │   ├───jdk.xml.dom
                    │   └───jdk.zipfs
                    └───lib
                        ├───jfr
                        └───security

没有生成exe,无法删除文件夹。 我一直在搜索是否有人遇到这个问题但没有成功,所以我 post 在这里编辑了它。先谢谢您的帮助!如果您需要有关此的更多信息,请询问。

您似乎使用了导致递归复制的错误参数。您已设置 --i--temp 以便输入文件夹是当前目录,因此包含临时文件夹 - 因此 jpackage 每次都将当前目录复制到 temp

只需为您的应用程序的重要结构创建一个目录,并将该独立文件夹引用为 --i myappstructure,然后 temp 将不会成为 --temp temp 自身的递归副本.

您不需要使用 --temp 参数,除非您希望在 jpackage app-imageexe 调用之间修改发布结构。