Jump to: navigation, search

Difference between revisions of "Execution Environments"

Line 1: Line 1:
 
==What are Execution Environments?==
 
==What are Execution Environments?==
 +
 +
Execution environments tell the compiler and runtime the minimum level of class libraries required by your plug-in.
  
 
==Why should I set them for my plug-in?==
 
==Why should I set them for my plug-in?==
 +
 +
Our goal should always be to minimize our dependancies to make our plug-ins useful in more scenerios. If you set your EE to be J2SE-1.3, then the compiler will help you stick to that and not let you use APIs which exist in other class library versions. If you choose to increase your EE level, then you are forced to explicitly do so, rather than finding out later that you did it accidentally by referencing new APIs.
  
 
==Which Execution Environment should I use?==
 
==Which Execution Environment should I use?==

Revision as of 17:44, 20 April 2006

What are Execution Environments?

Execution environments tell the compiler and runtime the minimum level of class libraries required by your plug-in.

Why should I set them for my plug-in?

Our goal should always be to minimize our dependancies to make our plug-ins useful in more scenerios. If you set your EE to be J2SE-1.3, then the compiler will help you stick to that and not let you use APIs which exist in other class library versions. If you choose to increase your EE level, then you are forced to explicitly do so, rather than finding out later that you did it accidentally by referencing new APIs.

Which Execution Environment should I use?

Check out the table of execution environments in the Eclipse 3.2 Plan. The execution environment listed in the table is what your plug-in is committed to. If there is an error with the table, please send a note to the eclipse-dev mailing list and someone will update the table.

Setting the Execution Environment

  1. Use build N20060420-0010 or later.
  2. Right click on your plug-in's MANIFEST.MF and select Open With... -> Plug-in Manifest Editor.
  3. Select the Overview tab.
  4. Note the section in the lower left corner entitled Execution Environments.
  5. Add your appropriate environment(s).
  6. Save the file.
  7. Select the link "update the classpath and compiler compliance settings".
  8. Ensure you have no compile errors in your workspace.
  9. Release your changes to the repository.


Special cases

Foundation Class Libraries

Plug-ins that are Foundation 1.0 should in fact list Foundation 1.0 AND J2SE-1.3 in their execution environments. This is because Foundation 1.0 is not a proper subset of 1.3. Listing them both will in essence say that the intersection of the two is valid for use in that plug-in. The situation is the same for Foundation 1.1 and J2SE-1.4.

Getting J9 is the easiest way to get a Foundation JRE to run or compile against.

Compiling Against More Than Is Required

In some cases, a plug-in may require a higher version to compile against, but is able to run perfectly fine against a lower version. For instance, the org.eclipse.osgi bundle will use java.nio.* classes if available. So it must be compiled against J2SE-1.4 but can run on OSGI/Minimum-1.0.

In these cases the EE required to compile against must appear first in the list. So for org.eclipse.osgi, the list (in order) is J2SE-1.4 then OSGI/Minimum-1.0.

XML

Some bundles may think that they require an EE of J2SE-1.4 but really the only special thing that they require from the 1.4 class libraries are the JAXP XML APIs. So in these cases they can be listed as having an EE of J2SE-1.3 because they still will run ok if another bundle is providing the XML APIs.