使用 Netbeans 导出 JAR

发布于 2024-10-08 18:20:51 字数 53 浏览 0 评论 0原文

如何使用Netbeans将java项目导出到JAR?我找不到像 Eclipse 那样的选项。

How to export java project to JAR with Netbeans ? I cannot find options like in Eclipse.

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

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

发布评论

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

评论(4

情释 2024-10-15 18:20:52

您需要启用选项

Project Properties ->构建->包装->编译后构建JAR

(但默认情况下启用)

You need to enable the option

Project Properties -> Build -> Packaging -> Build JAR after compiling

(but this is enabled by default)

自找没趣 2024-10-15 18:20:52

您的意思是编译到JAR吗? NetBeans 会自动执行此操作,只需执行“清理并构建”并查看项目的“dist”子目录即可。将有一个带有“lib”文件夹的 JAR,其中包含所需的库。这些 JAR + lib 足以运行应用程序。

如果在项目属性中禁用“保存时编译”,则不再需要执行“清理和构建”,在大多数情况下只需“构建”就足够了。如果您只想更改一些代码并重建 JAR,这将节省时间。但是,请注意,NetBeans 有时无法正确处理依赖关系和二进制兼容性,这将导致错误的 JAR 抛出“没有此类方法”或其他模糊的异常。因此,如果自上次完全重建以来您进行了很多更改,甚至远程不确定即使某些类没有重新编译它仍然可以工作,那么您仍然必须执行完整的“清理和构建”以获得完美的结果工作罐子。

Do you mean compile it to JAR? NetBeans does that automatically, just do "clean and build" and look in the "dist" subdirectory of your project. There will be the JAR with "lib" folder containing the required libraries. These JAR + lib are enough to run the application.

If you disable "Compile on save" in the project properties, then it is no longer necessary to do "clean and build", simply "build" will suffice in most cases. This will save time if you want to change just a bit of the code and rebuild the JAR. However, note that NetBeans sometimes fails to handle dependencies and binary compatibility properly, which will lead to a faulty JAR throwing "no such method" or other obscure exceptions. Therefore, if you made a lot of changes since the last full rebuild and even remotely unsure that it will still work even if some classes aren't recompiled, then you must still do a full "clean and build" in order to get a perfectly working JAR.

情深缘浅 2024-10-15 18:20:52

它默认执行此操作,您只需查看项目的 /dist 文件夹。

It does this by default, you just need to look into the project's /dist folder.

滿滿的愛 2024-10-15 18:20:52
  1. 右键单击您的项目文件夹。
  2. 选择属性。
  3. 展开构建选项。
  4. 选择包装。
  5. 现在清理并构建您的项目(Shift +F11)。
  6. jar 文件将在 your_project_folder\dist 文件夹中创建。
  1. Right click your project folder.
  2. Select Properties.
  3. Expand Build option.
  4. Select Packaging.
  5. Now Clean and Build your project (Shift +F11).
  6. jar file will be created at your_project_folder\dist folder.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文