Java Netbeans JAR 构建和运行

发布于 2024-08-22 22:52:39 字数 249 浏览 2 评论 0原文

我的 Netbeans 项目中有几个包。

其中一个包有一个 main 方法,该方法被设置为项目的 main 方法。

我使用 clean 并构建,并且 Jar 已成功创建,但是当我尝试运行 .jar 文件时,应用程序无法正确运行。

我正在运行的 Main.class 具有创建项目中其他包中其他类的实例的按钮,但是当我从命令行运行它时,单击按钮通常会在控制台中打印 null 或异常。如何设置 Netbeans 以便 .jar 成功运行?

I have several packages in my Netbeans project.

One of these packages has a main method, which is set as the main method for the project.

I use clean and build and the Jar is created successfully, however when I try and run the .jar file The application does not run correctly.

The Main.class that I am running has buttons that create instances of other classes which are in other packages within the project, however when I run it from the command line clicking the buttons usually prints null or an exception out the the console. How would I set up Netbeans so that the .jar runs successfully?

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

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

发布评论

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

评论(1

原谅过去的我 2024-08-29 22:52:39

“我如何设置 Netbeans 以便 .jar 成功运行?”

您不知道。一旦 jar 和 s 构建完成,它就是或者应该是独立的。 NetBeans 并没有什么问题吧。

您没有指定 NPE 发生的位置,但您的应用程序可能使用特定的文件结构,并且您尝试运行 jar,但没有或维护文件位于相同的位置或具有相同的名称在 NB 内与他们合作时。

"How would I set up Netbeans so that the .jar runs successfully?"

You don't. Once the jar and s built, it is, or should be, independent. NetBeans is not what's wrong with it.

You didn't specify where your NPEs are happening, but it's likely your application uses a certain file-structure, and that you're attempting to run the jar while not having or maintaining the files in the same positions or with the same names as when working with them within NB.

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