Order and Export Tab in Java Build Path

enter image description here

How do I use the Order and Export tab in the Java Build Path dialog box? By the name โ€œorderโ€, I can guess that the JRE System library is being searched for the dependencies of the plug-in, but why do we have โ€œExportโ€ in the build path? And what is this button to the left of the elements?

ADDED

This is an example that I borrowed from Eclipse distilled .

Orderes.webapp is order dependent, but it will probably use the classes defined in the ubl and directory.

enter image description here

In this case, orders can export the directory and ubl so that packages depending on it can use the directory and ubl.

enter image description here

And one more thing about Order and Export.

  • Checking the left button modifies the .classpath file to add exported=true , for example, <classpathentry exported="true" kind="lib" path="lib/log4j-1.2.7.jar"/> .
  • src is always checked, and you cannot remove it.

References

+18
eclipse build
Dec 18 '12 at 22:35
source share
5 answers

This tab seems to be pulling double debt (see the bottom of this man page for a few details).

On the one hand, it functions as a resolution order for the resources used in the construction of the project in question (the "Order" part). On the other hand, it also helps to determine which parts of this construction path are included in dependent projects "(those that list this project on the" projects "tab to view this preference panel) create paths (the" Export "part).

This last function is why the checkboxes exist on the left side, as you ask (note that the โ€œ-โ€ signs cannot be unchecked, since the source files defined in this project cannot be undone as indicated in the help file ) A dependent project that expects some resource from the project to be contributed to the project will not be compiled / executed if the incoming project does not export this resource.

EDIT: see this SO message for confirmation.

+7
Dec 18
source share

very good example from Coderanch Ilja Preuss

Say you have junit.jar in the build path of project A. Project B depends on project A.

Now you are writing a junit test in project B. If project A exports junit.jar, project B can use it at compile time - no further action is necessary. If A does not export it, B does not know about it - you will have to explicitly put it in your build path.

+4
Jan 22 '14 at 17:36
source share

Order and Export , you guessed it right, shows the order of the libraries that will be included in your project construction path.

Using the up and down buttons, you can customize the order of your libraries according to your projects.

+2
Dec 18 '12 at 22:50
source share

To answer your specific question, if this project should be added as a dependency for another Java project, the order will be used to resolve classes and packages in this project when starting another project. They say that these classes and packages are exported to / for another project class to be launched.

+2
Dec 18
source share

There is one case where I found this useful. I had to use the sun. * Class cans of IBM. This class was also present in the local jre, but my requirement was to use the IBM class. But by default, the compiler will only reference the local jdk class. On the Eclipse and Export tabs, I moved the external jar before the JRE lib. Now the compiler will refer to the class from the IBM jar instead of the local JRE.

+2
Mar 09 '13 at 11:34
source share



All Articles