[英]How do I set the classpath in NetBeans?
Can someone tell me where and how I set the classpath in NetBeans? 有人能告诉我在NetBeans中设置类路径的位置和方式吗? I would like to add a .jar file. 我想添加一个.jar文件。
Properties
. 选择Properties
。 Libraries
. 在左侧单击“ Libraries
。 Compile tab
- click Add Jar/Folder
button. 在“ Compile tab
- 单击“ Add Jar/Folder
按钮。 Or 要么
Libraries
. 右键单击“ Libraries
。 Add Jar/Folder
. 选择Add Jar/Folder
。 The Answer by Bhesh Gurung is correct… unless your NetBeans project is Maven based. Bhesh Gurung的回答是正确的......除非您的NetBeans项目是基于Maven的。
Under Maven, you add a "dependency". 在Maven下,你添加一个“依赖”。 A dependency is a description of a library (its name & version number) you want to use from your code. 依赖项是要从代码中使用的库(其名称和版本号)的描述。
Or a dependency could be a description of a library which another library needs ("depends on"). 或者依赖关系可以是另一个库需要的库的描述(“依赖于”)。 Maven automatically handles this chain, libraries that need other libraries that then need other libraries and so on. Maven自动处理这个链,需要其他库然后需要其他库的库等等。 For the mathematical-minded, perhaps the phrase "Maven resolves the transitive dependencies" makes sense. 对于具有数学意识的人来说,也许短语“Maven解决了传递依赖”是有道理的。
Maven gets this related-ness information, and the libraries themselves from a Maven repository . Maven从Maven存储库获取这些相关信息,以及库本身。 A repository is basically an online database and collection of download files (the dependency library). 存储库基本上是在线数据库和下载文件集合(依赖库)。
Adding a dependency to a Maven-based project is really quite easy. 向基于Maven的项目添加依赖项非常简单。 That is the whole point to Maven, to make managing dependent libraries easy and to make building them into your project easy. 这就是Maven的重点,使管理依赖库变得容易,并使它们很容易构建到您的项目中。 To get started with adding a dependency, see this Question, Adding dependencies in Maven Netbeans and my Answer with screenshot . 要开始添加依赖项,请参阅此问题, 在Maven Netbeans中添加依赖项以及使用屏幕截图 添加 我的答案 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.