Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The "Order and Export" tab in "Java Build Path"

Tags:

enter image description here

What's the use of "Order and Export" tab in "Java Build Path" dialog box? By the name 'order', I can guess that JRE System library is searched before Plug-in Dependencies, but why do we have 'Export' in Build Path ? And what's it for the button left side of the elements?

ADDED

It's the example that I borrowed from Eclipse distilled.

The orderes.webapp depends on orders, but it's likely to use the classes defined in ubl and catalog.

enter image description here

In such a case, orders can export catalog and ubl so that the packages that depends on it can use catalog and ubl.

enter image description here

And something more about "Order and Export".

  1. The check of the left side button modifies the .classpath file to add exported=true such as <classpathentry exported="true" kind="lib" path="lib/log4j-1.2.7.jar"/>.
  2. The src is always checked, and you can't uncheck it.

References

  • Interpreting eclipse .classpath file. What does 'kind="con"' and 'exported="true"' mean?
  • Configuring an Eclipse Java Project
  • Java Build Path
like image 962
prosseek Avatar asked Dec 18 '12 22:12

prosseek


People also ask

What is order and export in java build path?

In the Build classpath list, you can click the Up and Down buttons to move the selected path entry up or down in the build path order for this new project. Checked list entries are marked as exported. Exported entries are visible to projects that require the project.

What is a java build path?

Build path is used by the compiler to resolve dependencies and build a project. Classpath is used during runtime when running a project in order to find necessary dependencies. Build path is configured on the Java Build Path property page of a project.

Where is java build path in Eclipse?

In Eclipse select the web project and right-click Build Path > Configure Build Path. This will display the Java Build Path window.

What is build folder in Eclipse?

The java output directories are configured via Project Properties -> Java Build Path. You can go to that page to see what folders are being currently used. Note that Eclipse java build does not generate a jar. It generates a directory of classes.


1 Answers

This tab seems to pull double duty (see bottom of this help page for small amount of detail).

On one hand, it functions as the order of resolution for resources used in the building of the project in question (the "Order" part). On the other, it also serves to define what parts of this build path are contributed to dependent projects' (those listing this project in the "projects" tab for their view of this preference panel) build paths (the "Export" part).

This latter function is why the checkboxes exist on the left hand side, as you ask (note that the '-' signs cannot be unchecked, as source files defined in this project cannot be deselected, as stated in help file). A dependent project that expects some resource from the contributing project will not compile/run if the contributing project doesn't export that resource.

EDIT: see this SO post for corroboration.

like image 187
Brian Henry Avatar answered Sep 18 '22 13:09

Brian Henry