Enable Java in OpenOffice.org
OpenOffice.org uses a Java Virtual Machine to instantiate components written in Java. From OpenOffice.org 2.0 on, Java is found automatically during startup, or latest when Java functionality is required. If you prefer to preselect a JRE or JDK, or if no Java is found, you can configure Java using the Tools – Options dialog in OpenOffice.org and select the section OpenOffice.org – Java section. In older versions of OpenOffice.org you can also easily tell the office which JVM to use: launch the jvmsetup executable from the programs folder under the OpenOffice.org, select an installed JRE or JDK and click OK. Close the OpenOffice.org including the Quickstarter in the taskbar and restart OpenOffice.org. Furthermore, open the Tools - Options dialog in OpenOffice.org, select the section OpenOffice.org - Security and make sure that the Java enable option is checked.
Using the Java UNO runtime and API in your IDE
Next, the OpenOffice.org API and Java UNO runtime class files must be made known to the Java IDE. For NetBeans the necessary jar files are made available by simply installing the OpenOffice.org API Plugin for NetBeans. After the configuration the plugin installs a new library in NetBeans that can be used in projects directly. The library will be automatically added to new projects created with the project wizards coming with the plugin. The following steps show how to install the plugin in NetBeans 5.5 or higher and how to create a new UNO client application project.
- Install and start NetBeans
- from the Tools menu, select Update center. check mark at least the NetBeans Update Center and press Next. Under Features search for the entry OpenOffice.org API Plugin, select the entry, Add it, press Next, accept the license and follow the next steps to install it completely.
- A plugin specific configuration dialog comes up and required the input of a PATH to a valid office and SDK installation . After completion of this dialog the plugin is installed and configured correctly.
- From the File menu, select New Project. Select OpenOffice.org category and select the OpenOffice.org Client Application. Follow the next step and finish the project wizard.
- A new project with your specified name is created. The main function of a generated JAVA skeleton contains already the UNO bootstrap function that gives you access to an office context object as main entry point to get started with the OpenOffice.org API. The context object is from a remote office instance that is connected over a named pipe connection and the default office is started automatically if no instance is running.
Add the API Reference to your IDE
We recommend to add the API and the Java UNO reference to your Java IDE to get online help for the OpenOffice.org API and the Java UNO runtime. The generated reference documentation provides Javadoc conform index files that can be integrated in most Java IDEs. In NetBeans the IDL reference is automatically integrated with the installation of the OpenOffice.org API Plugin.
Using the reference in NetBeans is quite simple, type an IDL type in the editor and press F1. A further useful feature is the code completion feature that you get also automatically when you install the plugin.
|Content on this page is licensed under the Public Documentation License (PDL).|