简体   繁体   English

Eclipse向Eclipse首选项中添加类路径变量/库,而不是为特定项目添加路径

[英]Eclipse adding a Class path variable/Library to Eclipse preferences vs. adding a path to an specific project

I want to know what is the difference between adding a class path/library by "1) Eclipse>>Preferences>>Java>>Build Path >> Add Class path Variable/Library", and adding a classpath/library by adding it to an specific project by "2) Left-Click on the Project >> Properties>> Java Build Path >> Add Library OR Add class path"? 我想知道通过“ 1)Eclipse >>首选项>> Java >> Build Path >> Add Class path Variable / Library”添加类路径/库与通过将其添加到类路径/库之间有什么区别。通过“ 2)左键单击项目>>属性>> Java构建路径>>添加库或添加类路径”来访问特定项目?

If these methods are different. 如果这些方法不同。 How should I use each of them? 我应该如何使用它们中的每一个?

i. 一世。 By the first ("1 Eclipse>>Preferences>>Java>>Build Path >> Add Class path Variable/Library" ) method you will have two different option .. One is to add a classPath variable and one is to add the user libraries. 通过第一种方法(“ 1 Eclipse >> Preferences >> Java >> Build Path >> Add Class path Variable / Library”方法,您将有两个不同的选择。一个是添加classPath变量,另一个是添加用户库。 The CLASSPATH environment variable tells the Java Virtual Machine and other Java applications where to find the class libraries, including user-defined class libraries. CLASSPATH环境变量告诉Java虚拟机和其他Java应用程序在哪里可以找到类库,包括用户定义的类库。 On the other hand adding aa user libraries means that you r just adding some user defined libraries nothing more than that. 另一方面,添加一个用户库意味着您仅添加一些用户定义的库即可。

ii. ii。 On the Second way (Left-Click on the Project >> Properties>> Java Build Path >> Add Library OR Add class path") you have the various options to add various type of libraries including the user libraries.Other than user libraries you can add junit libraries and many more. 在第二种方式上(在项目>>属性>> Java构建路径>>添加库或添加类路径上单击鼠标左键),您可以使用各种选项来添加各种类型的库,包括用户库。可以添加junit库等。

The 'Preferences' Class path / Libraries entries just define the names and contents of variables and libraries. “首选项”类路径/库条目仅定义变量和库的名称和内容。 This does not add these entries to the build path of any project. 这不会将这些条目添加到任何项目的构建路径。

Once you have defined variables and libraries in the Preferences you can then add them to individual projects using the Project Properties Build Path. 在“首选项”中定义变量和库后,可以使用“项目属性构建路径”将它们添加到各个项目中。

Using a separate definition in the Preferences allows you to change the actual value of the variable / library without having the change every project. 在“首选项”中使用单独的定义可让您更改变量/库的实际值,而无需在每个项目中都进行更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM