Eclipse RCP product deployment. This tutorial describes how the product configuration file and the deployment of Eclipse applications. It also covers features.

1. Product configuration file

1.1. Overview

A product configuration file (product) defines the configuration of an Eclipse application. This includes icons, splash screen and the plug-ins or features included in your application. The Eclipse IDE allows to create new product files via File  New  Other  Plug-in Development  Product Configuration and provides an editor to easily change the file.

A product always points to one application class. The default applications for Eclipse applications are:

  • org.eclipse.ui.ide.workbench for Eclipse IDE based applications

  • org.eclipse.e4.ui.workbench.swt.E4Application for Eclipse RCP applications not related to the IDE

Product extension definition

It is also possible to use custom applications, which implement the IApplication interface.

On the Overview tab of this editor, you can start the product. Pressing the Synchronize link writes the relevant product configuration information into the plugin.xml file. Both settings are highlighted in the following screenshot.

Product definition file show the overview tab

On the Contents tab you can define the set of plug-ins or features which are included in the product, e.g., the plug-ins that are included if you start or export your product.

1.2. Splash screen

The Splash tab allows you to specify the plug-in which contains the splash screen. The name is predefined as splash.bmp and it must be located in the root of the plug-in directory. Therefore, you need to put a file called splash.bmp file into the project main directory. Currently Eclipse supports only Bitmap (.bmp) files.

Show the tab splash from the product configuration file

The predefined name and location of the splash screen image can be changed via the osgi.splashPath parameter, the file name can be changed with the -showsplash path_to_file.

1.3. Icons, launcher name and program arguments

You can configure the launcher name and icon for your product. The launcher is the executable program that is created during the deployment of the product. A launcher is platform specific. For example, the default launcher is called eclipse.exe on the MS Windows platform. This launcher has also an icon associated with it. To change the name and the icon, select the Launching tab of your product configuration.

Here you can specify the file name of the launcher and the icon which should be used. Make sure the format of the icons is correct, otherwise Eclipse will not use them.

The icon configuration depends on the platform you are using. Eclipse allows you to export your application for multiple platforms and uses the correct ones based on your product configuration.

In the Launching Arguments section you can specify parameters for your Eclipse application and arguments for the Java runtime environment. Program Arguments are parameters passed to the Eclipse application.

Highlighting the section where the icons are maintained.

1.4. Product configuration limitations

Currently the splash handlers, which can be registered via the Customization part of the Splash tab are not supported by the Eclipse 4 standard. Also, the configuration in the About Dialog and the Welcome Page section on the Branding tab is not directly supported in Eclipse 4 RCP applications.

Earlier releases supported a manual export via the product file. Unfortunately this does not work reliablely in newer releases. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=525280 for a status.

Therefore, you are advised to setup a Maven Tycho command line build for exporting your product.

2. Using features

2.1. What are feature projects and features?

Using the Eclipse wizards you can create feature projects, similarly on how you create plug-in projects. An Eclipse feature project contains features.

A feature describes a list of plug-ins and other features which can be seen as a set of related components. It also has a name, a version number and in most cases a license information assigned to it.

A feature is described via a feature.xml file. The following listing shows an example of such a file.

<?xml version="1.0" encoding="UTF-8"?>
<feature
      id="com.vogella.eclipse.featuretest.feature"
      label="Feature"
      version="1.0.0.qualifier"
      provider-name="vogella GmbH">

   <description url="http://www.example.com/description">
      [Enter Feature Description here.]
   </description>

   <copyright url="http://www.example.com/copyright">
      [Enter Copyright Description here.]
   </copyright>

   <license url="http://www.example.com/license">
      [Enter License Description here.]
   </license>

   <plugin
         id="com.vogella.eclipse.featuretest.feature"
         download-size="0"
         install-size="0"
         version="0.0.0"
         unpack="false"/>

</feature>

2.2. Advantages of using features

The grouping of plug-ins into logical units makes it easier to handle a set of plug-ins. Instead of adding many individual plug-ins to your product configuration file, you can group them using features. That increases the visibility of your application structure.

Features can be used to install them into Eclipse applications and for the definition of Eclipse products. Features can also be used as basis to define a launch configuration.

Eclipse provides several predefined features, e.g., the org.eclipse.e4.rcp for Eclipse RCP applications.

2.3. Feature or plug-in based products

A product can either be based on plug-ins or on features. This setting is done on the Overview tab of the product configuration file.

On the Contents tab in the product editor you enter the plug-ins or features your products consists of.

A product does not perform automatic dependency resolution. If you add a feature to your product and want to add its dependencies, press the Add Required button.

2.4. Creating a feature

You can create a new feature project via the File  New  Other…​  Plug-in Development  Feature Project menu entry.

If you open the feature.xml file you can change the feature properties via a special editor.

The Information tab allows you to enter a description and copyright related information for this feature.

The Included Plug-ins tab allows you to change the included plug-ins in the feature. If you want to add a plug-in to a feature, use this tab. A frequent error of new Eclipse developers is to add it to the Dependencies tab.

The Included Features tab allows you to include other features into this feature. Via the Dependencies tab you can define other features which must be present to use this feature.

The Build tab is used for the build process and should include the feature.xml file. The last two tabs give access to the configuration files in text format.

3. Deployment of your application

3.1. Creating a stand-alone version of the application

An Eclipse application needs to be exported (also called: deployed) to run outside of Eclipse. Exporting your product creates a folder with all required artifacts to run your application. This includes a native launcher specific to the platforms, e.g., Windows or Linux, you have exported it for.

3.2. Exporting via the product file

Select your product configuration file to export your application. Select the Overview tab and click on the Eclipse Product export wizard link. In the wizard you can specify the target directory for the export via the Directory property in the Destination group/section. The export wizard is depicted in the following screenshot.

pdeexportwizard10

The Root directory property can be used to specify a sub-folder in the destination which contains the complete exported application. This is useful, if you export the product as an archive file.

The resulting directory can be shared with others, typically as an archive (zip) file. The export dialog allows you to create an archive file directl.

If the Generate p2 repository option is selected, an (p2) update site is generated in a repository folder. This folder can be used to update the Eclipse RCP application via the p2 API.

If you transfer the content of this directory to another machine (with the same architecture, e.g., Linux 64 bit), your application can start on this machine. Of course, the correct Java version must be installed on the target machine.

3.3. Defining which artifacts are included in the export

The artifacts which are included in an export are defined by the build.properties file of the plug-in. Eclipse provides an graphical editor for this file.

Eclipse adds the compiled Java classes by default. Other files must be added manually, e.g., icons or splash screen images.

An Eclipse application started from the Eclipse IDE has access to all resources available in the IDE. But to make them available in the exported application you need to select them in the build.properties file.

It is good practice to include new required resources immediately in the build.properties file. This avoids errors after the export of your application.

A product is a development artifact and is not required at runtime.

3.4. Mandatory plug-in artifacts in build.properties

Make sure the following items (if available) are included in each plug-in of the exported application
  • META-INF/MANIFEST.MF

  • plugin.xml

  • other static files, e.g., icons, splash.bmp, etc.

  • Application.e4xmi

  • CSS files

  • OSGi service definition files

  • model fragments

  • translation files

The screenshot below shows the build.properties file for a plug-in with most of these components.

buildproperties10

3.5. Common product export problems

3.5.1. Problems with the export and log files

During the export or the start of the exported application you may encounter problems. If your application got successfully exported but cannot be started you find a log file ending with the .log extension in the configuration folder of your application. This file contains the error you encountered.

Alternatively the export process may fail. In both cases you can use this chapter as reference to try to find and fix the reason for the failure.

3.5.2. Export problem number #1: export folder is not empty

The most common problem is that the folder to which you export is not empty. If you export to a certain folder, ensure that the folder is empty. Exporting twice to the same folder may create file locks or results in error messages reporting version conflicts.

3.5.3. Checklist for common export problems

If the export encounters a problem please have a look into the following table for a solution:

Table 1. Problems with the product export
Problem Possible cause

Export fails

Try using an empty target directory, sometimes the export cannot delete the existing files and therefore fails.

No executable file after the export

Check the flag "The product includes native launcher artifacts" in your .product file on the Overview tab.

Product could not be found

Validate that all dependencies are included in the product. Delete an existing launch configuration and restart the product from the IDE to see if everything is configured correctly.

Splash screen or other icons are missing

Check the build.properties file to see if all required images and icons are included in the export.

Splash screen is missing

Ensure that you have entered the defining plug-in in the "Splash" tab on the product configuration file. If this is not set, the splash screen is not displayed after the export. Unfortunately, it is displayed if you start the plug-in from the Eclipse IDE.

Issues during start of the application

Check the log file in the workspace folder of your exported application to see the error messages during the start process. Alternatively add the "-consoleLog" parameter to the ".ini" file in folder of the exported application.

applicationXMI argument is missing

Check the build.properties file to see if the Application.e4xmi and the plugin.xml files are included in the export.

Service could not be found or injected

Make sure that the bundle which provides the service has the Activate this plug-in when one of its classes is loaded _ flag set. Also make sure that the org.apache.felix.src bundle is started automatically with a _Start Level less than 4.

Application ID could not be found

Define a start level of 1 and set auto-start to true for the org.eclipse.core.runtime plug-in.

Translations not available in the exported product

Ensure via the build.properties file of the relevant plug-in that the files containing the translations are included in the export.

3.6. Including the required JRE into the export

You can also deploy your own RCP application bundled with a JRE to make sure that a certain JRE is used. An Eclipse application first searches in the installation directory for a folder called jre and for a contained Java-VM. If it finds one, then this JRE is used to start the Eclipse application.

To include the JRE from your running environment, select the Bundle JRE for this environment with the product flag on the Launching tab of your product configuration file.

3.7. Exercise: Using a static splash screen

Add a splash screen to your application. For this create or download a splash.bmp bitmap file.

Add the splash.bmp file to the main directory of your application. You can copy and paste it into the Package Explorer or Project Explorer view.

If you add files outside of the Eclipse IDE, you need to Refresh your project to see the file in Eclipse. This can be done via the F5 keybinding in the Package Explorer view.

The file name and the location of the file must be correct, otherwise Eclipse will not use your splash screen.

On the Splash tab of your product configuration file, define that your application plug-in contains the splash screen.

Adding splash to the product configuration file

Start your application from the Eclipse IDE and verify that the splash is displayed.

3.8. Include the splash screen into the exported application

Configure that the splash.bmp file is included into the exported application by adding it to the build.properties file of your application plug-in.

Add splash to build properties

Make sure that the target directory of the export is empty before you start the export.

4. Exercise: Create a feature based product

4.1. Create a feature project for your generated RCP application

Create a new feature project called com.example.e4.feature via the File  New  Other…​  Plug-in Development  Feature Project entry. The following screenshot shows the first wizard page.

Creating a feature

Include the com.example.e4.rcp plug-in into the new feature.

Include plug-in into a feature

4.2. Create a new project for the product configuration file

While you could leave the .product file in it current location, a command line build will expect it in a separate project. Create therefore a new project of type "General" named com.example.e4.product and move the product file to this project.

create e4 wizard product10

Also ensure that the ID field is set, this is also required for a command line build.

create e4 wizard product20

4.3. Change the product configuration file to use features

Ensure that the .product file is open. Select the Overview tab and ensure the `based on features options is selected.

Switching to features in the product configuration file

4.4. Add the features as content to your product

Switch to the Contents tab in your product editor. Add the following features to your product via the Add…​ button.

  • com.example.e4.feature

  • org.eclipse.e4.rcp

Afterwards, press the Add Required button. This adds the dependencies of the org.eclipse.e4.rcp feature to the product.

Switching to features in the product configuration file

Ensure that you have the four features from the screenshot included in your product.

4.5. Start the application via the product

Start your application via the product configuration file and ensure that the application starts correctly.

If the application does not start, check:

  • that you have included all four features

  • that you start your application via the product configuration and NOT with an existing launch configuration. This ensures that your new product configuration is used.

5. Eclipse product and export resources