JPackage 不生成工作 exe 和 bugs 文件夹

Posted

技术标签:

【中文标题】JPackage 不生成工作 exe 和 bugs 文件夹【英文标题】:JPackage doesn't generate working exe and bugs folders 【发布时间】:2021-10-01 22:56:29 【问题描述】:

我正在尝试使用 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$2.preVisitDirectory(IOUtils.java:119)
        at jdk.jpackage/jdk.jpackage.internal.IOUtils$2.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$2.preVisitDirectory(IOUtils.java:119)
        at jdk.jpackage/jdk.jpackage.internal.IOUtils$2.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 似乎没有结束,我缩短了它,因为我达到了帖子的字符数限制。此外,如果我现在尝试删除顶部的“测试”文件夹,我会得到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$2.preVisitDirectory(IOUtils.java:119)
        at jdk.jpackage/jdk.jpackage.internal.IOUtils$2.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$2.preVisitDirectory(IOUtils.java:119)
        at jdk.jpackage/jdk.jpackage.internal.IOUtils$2.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,也无法删除该文件夹。 我一直在寻找是否有人遇到此问题但没有成功,所以我将其发布在这里。在此先感谢您的帮助!如果您需要有关此的更多信息,请询问。

【问题讨论】:

【参考方案1】:

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

只需为您的应用的重要结构创建一个目录并引用该独立文件夹,例如--i myappstructure,然后temp 将不会递归复制到它本身与--temp temp

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

【讨论】:

谢谢,它有效!关于如何删除文件夹的任何想法? 要么根本不使用--temp,或者如果您需要它来调整两次 jpackage 启动之间的发布结构,只需在构建过程中添加一个 clean 目标以擦除临时目录每当您开始重新构建应用程序时。 谢谢,但我的意思是那些在我尝试删除文件浏览器时崩溃的文件。我想也许Linux可以删除它们?我会尽可能尝试,但我想有更多方法以防它不起作用 如果您可以访问 Linux,rm -rf tempmv temp /tmp 可能会有所帮助,或者您可以尝试将某些目录级别的目录名称重命名为更短的名称,看看这是否可以绕过冻结 /您正在达到 32k 限制。 自己完成后,您可以在 PowerShell 中 Set-ItemProperty 'HKLM:\System\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -value 1rm -Path <yourpath> -Recurse。注册表修改是为了绕过legacy路径限制,否则PS无法获取完整路径。

以上是关于JPackage 不生成工作 exe 和 bugs 文件夹的主要内容,如果未能解决你的问题,请参考以下文章

JPackage 版本错误(%JAVA_HOME% 设置为正确目录)

c#写的winform生成EXE程序在有些电脑打不开,出现“程序已停止工作”的错误,错误日志如下:

jpackage在Java 16中可以投入生产

jpackage 命令无法识别

Java 程序在 jpackage 时使用了错误的语言环境

关于python3.6 cxfreeze打包 的一个Bug