OpenOffice NetBeans Integration

From Apache OpenOffice Wiki
Revision as of 06:58, 14 October 2008 by Sg (Talk | contribs)

Jump to: navigation, search


The API plugin for NetBeans simplifies the development of extensions. You can use the API to program, and automate remote or in process tasks extend with completely new functionality. The API plugin for NetBeans simplifies accessing and using of the API in new projects and simplifies the task of creating complete extension packages (comparable to the NetBeans plugin modules).

Download and Installation

Download the latest version from within NetBeans by clicking on Tools - Plugins. You can find the plugin in the "Available Plugins" section as " API Plugin". Install it and try it out! The configuration is self explanatory, for detailed information see Configuration.


Overview of the features included in the current plugin.

Project Types

Click on "File" - "New Project..." and choose category "" to open a new project. All project types create working code. Once the project wizard is finished, a working compilable project is created. It may not do anything, but it can be used in from the beginning.

This project type creates an adapted J2SE client application project with additional support of the simple UNO bootstrap feature. To enable this, some pre-compiled glue code is bundled with the client application. The result is a portable jar file that bootstraps on any supported OS.

This project type creates an adapted J2SE class library project with special support for a UNO component library and an office extension package. The wizard collects the necessary information for new Calc built-in functions and abstracts from the underlying UNO technology.

This project type creates an adapted J2SE class library project with special support for a UNO component library and an extension package. The wizard collects information about services and additional optional interfaces which should be implemented. Additional IDL types can also be defined. A complete code skeleton is generated, with the component helper functions and the default interface methods already implemented.

This project type creates an adapted J2SE class library project with special support for a UNO component library and an extension package. The wizard collects the necessary information for an Add-On component and generates an Add-On specific code skeleton.

File Types

Click on "File" - "New File..." and select "" as category to create a new file for an project. Note, that the category is available in all projects, although it only makes sense to use it in one of the projects stated above.

  • xcu file type

Create an empty xcu file type. The files are recognized in NetBeans and syntax highlighting is supported.

  • xcs file type

Create an empty xcs file type. The files are recognized in NetBeans and syntax highlighting is supported.

  • UNO idl file type

You can use a file type wizard to create idl files. In the first step, you must select the name location and UNO type (e.g. Service or Interface). You can add additional information in the second step. When an interface is created, the second step asks about the functions that the interface should contain. A complete working idl file is created, and NetBeans provides syntax highlighting. When you choose to also create an implementation object (only available for service or interface), a Java skeleton file implementing your new idl file will also be created.

  • Java UNO Object file type

This file wizard creates a Java skeleton file that implements all functions defined in an interface or service idl file. If you choose a service, the Java implementation file will also be registered in when your extension is deployed.

Create, deploy and debug

These are actions that are available in the context menu of an extension project in the "Project" view.

  • Debug Extension in Target

If necessary, "Create OXT" is executed. The resulting OXT file is registered in a temporary user installation of, which is located in the build directory of the project. (Cleaning of the project removes the user installation again.) Then is started with this user installation. To trigger the registered extension, an appropriate action must be done in Execution stops at any breakpoints added to the code of the extension and debugging can start from there.

  • Deploy and Run Extension

If necessary, "Create OXT" is executed. The resulting OXT file is registered inside the user installation of Then is started.

  • Create OXT

If necessary, your code is compiled. The resulting jar file is packed into an OXT file, together with other necessary files such as configuration files, a manifest file, and images. The OXT file is located in the "dist" directory of the project.

  • Publish Extension on Website

The starting page for uploading and publishing your extension on is loaded in your default web browser.


  • External Jars

Additional external jars that are used in an extension are automatically copied into the OXT file and added to the extension's classpath. A registered extension in can still use the functionality provided there. The jars can be added to the project as a single jar or as part of a NetBeans library. Note: All the jars from a library will be added to the OXT file, independent from their usage in the extension.


Find here links to the specifications of the plugin on the page. Plugin for NetBeans Plugin for NetBeans: Add-On Wizard Plugin for NetBeans: Add-In Wizard Plugin for NetBeans: Component Wizard Plugin for NetBeans: Debug Feature Plugin for NetBeans: IDL type support Plugin for NetBeans: Support description.xml

Working with the plugin

The following section describes how you can work with the plugin and describes the requirements because the plugin make use of some external stuff provided by an office and the SDK.


The plugin works only in combination with and an appropriate Software Development Kit (SDK). The minimal suggested version is 2.0.4. With earlier versions, some features of the plugin will not work.

Note that the versions of and the SDK must match for everything to work.


Before you can use the new project types you must configure the plugin because it needs an installed and SDK. Note that that a standard installation will be found by the plugin and entered in the options as suggestion. You can always change that to a different version.

Note: If you change the or SDK installation, these changes are effective for projects created from now on only.

For changing the office and SDK installation please choose

  • Tools -> Options -> Miscellaneous -> OOo API plugin

and select a valid and SDK installation.

OpenOffice Extensions Plugin Options.png

The configuration step automatically installs a new library which can be used in other projects to support the API. Including this library in your own projects enables context sensitive help and code completion.

Note: on Debian/Ubuntu, the installation directory is /usr/lib/openoffice/. For other *nix platforms the location may vary, but you can find the location by inspecting the shell script /usr/bin/ooffice to see where the ooqstart executable is in your installation.

Working with new Project Types

The plugin integrates four new project types under the category StarOffice/

  • StarOffice/ Add-On
  • StarOffice/ Calc Add-Ins
  • StarOffice/ Client Application
  • StarOffice/ Component

The wizards will collect the necessary information to create the new projects and should follow the NetBeans philosophy. You can simply choose

  • File -> New Project -> StarOffice/ -> <project_type>

For more details about the project types please take a look at

Known Problems and Missing Features

  • Context sensitive help does not work on Linux (Solaris not yet tested), even the javadoc generated Java UNO runtime reference documentation does not work on Linux. Under Windows both work as expected.
  • The integrated update center module does not work on Unix systems (known bug 72960 in NetBeans which is fixed in NetBeans 6.0). Workaround is to install NetBeans locally where you have write access.
  • The backward compatibility mode for Calc Add-Ins creates still an .oxt extension package. This of course makes no sense for older versions because this file extension was first introduced in 2.0.4. Please simply rename it to .uno.pkg
  • The selection of a category for Calc Add-ins has currently no effect. New function will always be in the category Add-In. The corresponding issue 77984 is already fixed and will be available in 2.3.
  • (LINUX) After configuring Netbeans (5.5) correctly, you may not be able to start a newly created application. An error " no office executable found!" occurs. Follow the steps described below to fix that problem. Assuming you have created a new OO Client Project using the New Project Wizard.
    • Edit the project properties
    • Libraries : Add Jar/Folder : /usr/lib/openoffice/sdk/classes (for Debian users, location may vary for other distributions) Provide the directory, where the SDK "com" classes directory can be found.
    • Run : (Yes, the main class is the loader)
    • Run : Arguments=org.openoffice.OfficeUNOClientApp (the first argument is the main class)
    • VM"/usr/lib/openoffice/program" (Tell the Java machine where to find the OO stuff)
    • Rebuild and run !
  • (v5.5.1 LINUX - Ubuntu 7.10, OpenOffice 2.3) After configuring Netbeans, attempts to create a project results in the error:
While executing an SDK Command, the following error happened:
/usr/lib/openoffice/sdk/linux/bin/uno-skeletonmaker: 4: basename: not found
/usr/lib/openoffice/sdk/linux/bin/uno-skeletonmaker: 4: /usr/lib/openoffice/sdk/linux/bin/.bin: not found
The problem is that the wrapper scripts in /usr/lib/openoffice/sdk/linux/bin/ do not have a PATH variable set and cannot find the "basename" command. There are 14 identical scripts in this directory that use their name to call the .bin executable. A work around is to edit one of the scripts and replace `basename $0` with `/usr/bin/basename $0` then copy that script over each of the other scripts.


Release Version Planned Release Date Release Date Planned Features
1.0 05/08/07 05/08/07 -
1.1 09/01/07 09/18/07 see 1.1
1.1.1 03/08 03/20/08 see 1.1.1
1.1.2 04/08 04/30/08 see 1.1.2
1.1.3 06/30/08 - see 1.1.3
2.0 09/08 - see 2.0
  Detailed download statistics can be found here
  • Issues for using the plugin with NetBeans 6.

Planned Features

The focus is on creating new wizards for various tasks plus common basic functionality. The main programming language is Java. Support for C++ is also planned and depends on the C++ support in NetBeans which will be available at least for NetBeans 6.0. The planned feature list is not final and more specialized wizards for other service provider interfaces (SPI) are coming in the future.

New Project Types

  • Scripting Project Type
    This new project type will create an adapted J2SE class library project with special support for scripting. It should provide you the possibility to import scripts from and open documents, edit, change and build these scripts, debug them and export them back (currently the support is planned for Java scripts only).
  • SmartTag Project Type
    This new project type will simplify the development of SmartTags for the Writer application.
  • API Library API Wrapper Project Type
    This new project type should create a Library Wrapper Module to support simple usage of the API in your own projects. It bundles the necessary API jar files from in the library and in client applications. This of course is necessary to make use of the API in clients running on machines where no is installed and where the communication with is made over a remote socket connection.

Common Features

  • Editor for xcu files
    This must be defined in detail but we can think of a special editor for OpenOffice .org configuration files.

Quality Assurance

If you find bugs please submit a new issue in the category sdk and the subcomponent netbeans-integration


Things to be done


We will continuously extend and improve the plugin in the future and your feedback is welcome and highly appreciated. We would like to invite you to discuss it on (Note: you have to be subscribed on the mailing list).

You can also submit new feature or enhancement requests in the issue tracker in the category sdk and the subcomponent netbeans-integration

Personal tools