java Netbeans:库不包含在项目文件夹中

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14163966/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 15:18:32  来源:igfitidea点击:

Netbeans : Library's are not included in the project folder

javanetbeans

提问by Chris Headleand

I need to package a netbeans project up as a zip so I can send it around a few developers. However I have built a library as another project and included it as a library using the netbeans "add project" option.

我需要将一个 netbeans 项目打包为一个 zip 文件,以便我可以将它发送给几个开发人员。但是,我已经构建了一个库作为另一个项目,并使用 netbeans“添加项目”选项将其作为库包含在内。

However....

然而....

the libray is never added to the project folder... is there a setting I can change that include the jar so other developer can unzip the project and use "out of the box"?

libray 永远不会添加到项目文件夹中......是否有我可以更改的设置,包括 jar 以便其他开发人员可以解压缩项目并使用“开箱即用”?

Cheers

干杯

回答by ollo

Not sure if this is what you need:

不确定这是否是您需要的:

  1. Right click on your project -> Properties
  2. Libraries-> Libraries Folder-> Browse
  3. Select the folder [Step 1](eg. insert ./lib- directory is created if not existing) -> Next
  4. Set the Actionsas you need [Step 2], maybe the default action ("Use Existing ...") is already what you need
  5. Finish
  1. 右键单击您的项目-> Properties
  2. Libraries-> Libraries Folder->Browse
  3. 选择文件夹[Step 1](例如,插入./lib- 如果不存在则创建目录)-> 下一步
  4. 根据需要设置操作[Step 2],也许默认操作(“使用现有...”)已经是您需要的
  5. Finish

This will ...

这会 ...

  • Create a common Lib directory in your project folder
  • If you clean & buildyour project there will be a lib folder in the dist directory which contains all your libraries of the project
  • 在你的项目文件夹中创建一个公共的 Lib 目录
  • 如果您清理并构建您的项目,则 dist 目录中将有一个 lib 文件夹,其中包含您项目的所有库

回答by shaanyes

Netbeans will package the jar in a lib folder only if the project is a java application project. i.e. it should be a java project with a class having main method. It should be specified in the Run category of the Project Properties. If you run the clean and build, the dist folder will have the application jar and the library will be added as a jar under the lib folder. The contents of the dist folder could then be zipped and shared with other developers. They should be able to execute it out of the box. Note: The manifest file of the application jar will have a class path entry to the library.

仅当项目是 java 应用程序项目时,Netbeans 才会将 jar 打包到 lib 文件夹中。即它应该是一个带有 main 方法的类的 java 项目。它应该在项目属性的运行类别中指定。如果运行 clean 和 build,dist 文件夹将包含应用程序 jar,并且库将作为 jar 添加到 lib 文件夹下。然后可以压缩 dist 文件夹的内容并与其他开发人员共享。他们应该能够立即执行它。注意:应用程序 jar 的清单文件将有一个到库的类路径条目。

If you need the the same behaviour for java projects that are not applications, modify the ant scripts.

如果对于非应用程序的 java 项目需要相同的行为,请修改 ant 脚本。