Eclipse URE Tutorial

From Apache OpenOffice Wiki
Jump to: navigation, search

How Eclipse can help in URE applications creation component model named UNO can be used to create new applications. This is possible because a subset of managing the UNO environment has been extracted to allow standalone components. To use this subset, named URE, some UNO knowledge are required. This document will show how every Java developer could create its own URE application without too much effort thanks to the Eclipse integration.


This tutorial is about guiding you through the creation of an URE application. It supposes that you have already read the general Java component tutorial. The "See Java Component Tutorial" mention in this document will ask you to have a look at the Java component tutorial first. For the Eclipse integration installation or explanations on the component, please refer to the corresponding section in the Java component tutorial.

Here are the definition of some terms and abbreviations used in this tutorial:

  • URE UNO Runtime Environment, a subset of hosting and managing UNO components.
  • UNO Universal Network Objects, component model.

Creating the application

An URE application is only a UNO component implementing the com:sun:star:lang:XMain interface. For an easier comparison, this interface is to UNO what the static main method is to C/C++ or Java. Running an URE application is telling UNO which Xmain:run() method to run, then your application is started and you can do your job.

The Eclipse integration provides a simple wizard to create a URE application: this helps you to remember which interface has to be implemented and how to register it to the URE. It provides an easy way to run your URE applications in the Eclipse fashion.

Creating the main component

To launch the URE application creation wizard, you can either select File > New > Project Wizard and then choose UNO > New URE based Application or click on the arrow on the right of the new UNO component icon in the tool bar. Then you will have only the first page of the new UNO component creation wizard. (See Java Component Tutorial).

After having terminated the wizard, you will have a new service exporting the XMain interface and a skeleton for its implementation. The only thing you need to do is to place your code in the run() method. For example, you could change the opened file into the following:

public int run(String[] aArguments)
    System.out.println( "Here is a postcard from the URE world !" );
    return 0;

Running the application

To run your newly created application, open the Run > Run... menu, select "URE Application" in the left list and click on the button New on the top. Then, give a name to the launch configuration, select the UNO project corresponding to the URE application to run and then the name of the XMain implementation class. Note that you will have no classes to select if the selected project contains no class implementing XMain. You can even use the arguments field to pass the command line arguments expected by your application. Then save the launch configuration and run it: your application will be executed. In our case, we will simply see the "Here is a postcard from the URE world !" text in the Eclipse console.

Now introduced to the URE world, don't hesitate to develop more complex applications and submit us any feedback.

Personal tools