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 OpenOffice.org 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.
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:
// com.sun.star.lang.XMain: public int run(String[] aArguments) { System.out.println( "Here is a postcard from the URE world !" ); return 0; }
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.