The Java Environment in Apache OpenOffice

From Apache OpenOffice Wiki
Jump to: navigation, search



When UNO components written in Java are to be used within the office suite, the office suite has to be configured to use the appropriate JRE. For information on the supported JREs see Documentation/FAQ/Installation/Which version of Java do I need?.

Apache OpenOffice

Since the release of Apache OpenOffice 3.4.0 you can set the JRE from the menu Tools->Options : tree node OpenOffice->Java.

OpenOffice.org 2.0

In OpenOffice.org 2.0 there is no java(.ini|rc) anymore. All basic Java settings are set in the options dialog: tree node OpenOffice.org->Java. The Parameters dialog can be used to specify the debug options and other arguments.

For applets there are still a few settings on the security panel (tree node OpenOffice.org->Security).

Versions prior to OpenOffice.org 2.0

Prior to OpenOffice.org 2.0, this configuration happened during the installation, when the Java setup was performed. Then, a user could choose a Java Runtime Environment or choose to install a JRE. After installing the office, the selected JRE could still be changed with the jvmsetup program, which was located in the program folder. The data for running the Java Virtual Machine was stored in the java(.ini|rc) file and other configuration files.

Documentation note.png The java(.ini|rc) actually is an implementation detail. Unfortunately, it needs to be modified under some rare circumstances, for example for debugging purposes. You must not rely on the existence of the file nor should you make assumptions about its contents.

In an office with a lower version than 2.0, the java(.ini|rc) is located in the <officepath>\user\config directory. A client can use that file to pass additional properties to the Java Virtual Machine, which are then available as system properties. For example, to pass the property MyAge, invoke Java like this:

 java -DMyAge=30 RunClass 

If you want to have that system property accessible by your Java component you can put that property into java(ini|rc) within the [Java] section. For example:

 [Java]
 Home=file:///C:/Program%20Files/Java/j2re1.4.2
 
 VMType=JRE
 Version=1.4.2
 RuntimeLib=file:///C:/Program%20Files/Java/j2re1.4.2/bin/client/jvm.dll
 SystemClasspath=d:\645m15\program\classes\classes.jar;; ...
 Java=1
 JavaScript=1
 Applets=1 
 MyAge=27

To debug a Java component, it is necessary to start the JVM with additional parameters. The parameters can be put in the java.ini the same way as they would appear on the command-line. For example, add those lines to the [Java] section:

 -Xdebug
 -Xrunjdwp:transport=dt_socket,server=y,address=8000

More about debugging can be found in the JDK documentation and in the Apache OpenOffice Software Development Kit.

Java components are also affected by the following configuration settings. They can be changed in the Tools - Options dialog. In the dialog, expand the OpenOffice node on the left-hand side and choose Security. This brings up a new pane on the right-hand side that allows Java specific settings:

Java Setting Description
Enable If checked, Java is used with the office. This affects Java components, as well as applets.
Security checks If checked, the security manager restricts resource access of applets.
Net access Determines where an applet can connect.
ClassPath Additional jar files and directories where the JVM should search for classes. Also known as user classpath.
Applets If checked, applets are executed.
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages