Home >Java >javaTutorial >What is Build Path? Why use Build Path?

What is Build Path? Why use Build Path?

零下一度
零下一度Original
2017-06-25 10:35:194970browse

What is Build Path?

Build Path is a collection of resource attributes contained in a specified Java project.

In a mature Java project, there is not only the source code written by yourself, but also the system runtime library (JRE), third-party function extension library, other projects in the workspace, and even external Class files, all these resources are dependent on this project, and only after being referenced can the project be successfully compiled, and Build Path is used to configure and manage references to these resources.

Build Path generally includes:

  1. JRE runtime library

  2. Third-party function extension library (*.jar format file )

  3. Other projects

  4. Other source codes or Class files

Why use Build Path?

By using Build Path, you can better manage the resources contained in the Java project and make the project structure clear and reasonable.
On the contrary, as the code and functions increase, the project structure will become messy and difficult to manage.

Specific content introduction in Eclipse:

Steps to open the Build Path management interface:
Right-click on the project—>Build Path—>Configure Build Path

What is Build Path? Why use Build Path?

Projects options: You can add, edit, and remove projects that the current project depends on.

Libraries option: You can add, edit, and remove library files that the current project depends on.
Add JARs: Add jar files in the current project directory.
Add External JARs: Add jar files in external directories outside the current project.
Add Variable: is to add variables.
Add Library: It is a library that adds the JRE system.
Add Class Folder: Add the compiled .class file in the current project.
Add External Class Folder: Add .class files outside the current project.

Order and Export: You can sort the libraries that have been added to the current project, and you can also set whether the library files are also exported with the project when the current project is exported.

Note:
1. After changing the version of the system library of the project, problems will occur if the high version is changed to a low version, but there is no problem if the low version is changed to a high version.
Because some packages in the higher version of the system library do not exist in the lower version of the library. Therefore, the lower version of the system library has good adaptability.
What is Build Path? Why use Build Path?

2. After changing the version of the system library of the project, if it is changed from a higher version to a lower version, you need to change the JDK compatibility option to the current version of JDK . But if the system library is changed from a lower version to a higher version without changing the JDK compatibility, there is no problem.
Because of JDK compatibility, the JDK version used is related to the JRE version we selected when we created the project.
The reason why changing the system library from a lower version to a higher version does not require changing the JDK compatibility is that the higher version of JDK is compatible with the lower version.
What is Build Path? Why use Build Path?

The above is the detailed content of What is Build Path? Why use Build Path?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn