发现 Java 程序启动错误?

发布于 2024-12-19 12:04:35 字数 529 浏览 1 评论 0原文

我用 Java 创建了一个快速程序,只是为了在开始编写实际程序之前开始使用 Java 的基于 GUI 的元素。在 Netbeans 中,一切都可以完美编译,并且 GUI 具有我放入其中的所有元素,因此当我使用 Netbeans 时没有问题。

然而,在构建并打包到 JAR 中后,我没有打开任何结果。我尝试过使用 Webstart 和其他我能想到的东西,但没有得到不同的结果。然而,JAR 确实会随着我的程序的变化而改变大小,所以我知道有些东西正在工作,我只是缺少一个文件或类似的东西。

编辑:

清单在构建后显示以下内容(位于 JAR 内):

Ant-Version: Apache Ant 1.8.2
Created-By: 1.6.0_26-b03 (Sun Microsystems Inc.)
Class-Path: 
X-COMMENT: Main-Class will be added automatically by build
Main-Class: com.nmagerko.Execute

I created a quick program in Java just to get started with the GUI-based elements of Java before I start writing the actual program. In Netbeans, everything compiles perfectly, and the GUI has all of the elements I put into it, so there is not problem when I am using Netbeans.

However, upon building and packaging into the JAR, I have no result on open. I have tried to use Webstart and everything else I could think of, but I get no different result. The JAR does, however, change size along with the varying of my program, so I know something is working, I just must be missing a file or something of that nature.

EDIT:

The manifest says the following after the build (This is inside the JAR):

Ant-Version: Apache Ant 1.8.2
Created-By: 1.6.0_26-b03 (Sun Microsystems Inc.)
Class-Path: 
X-COMMENT: Main-Class will be added automatically by build
Main-Class: com.nmagerko.Execute

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

倥絔 2024-12-26 12:04:35

我已经找到答案了。

在 @Mocker Tim 的帮助下,我发现使用 java -jar program-name.jar 可以获取 Netbeans 无法捕获的详细信息。

这最终是因为我的图标路径有太多“/”,删除这个斜杠可以使程序正确地被破坏。

I have found the answer.

Using help from @Mocker Tim, I found that using java -jar program-name.jar allowed for details that Netbeans did not catch.

This ended up being the fact that my path to my icon had one too many "/"'s, and removing that one slash allowed for the program to be jarred correctly.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文