Calling OpenOffice.org from a Java program

Java, C++, C#, Delphi... - Using the UNO bridges
Post Reply
Didier Besset
Posts: 1
Joined: Wed May 04, 2011 9:37 am

Calling OpenOffice.org from a Java program

Post by Didier Besset »

I have build an application that uses OpenOffice to maintain its texts.

Since OO 3.x, several environment variables must be set: UNO_PATH env. variable and the class path set to the folder where the DLL are located

This has been done so far without problem for a machine where the OO installation is well known. However,we wish to distribute this application as a WebStart app within our organisation, thus, cannot ensure the where OO has been installed.

Since we can retrieve the registry keys (Layers\URE\1 - UREINSTALLLOCATION and UNO\InstallPath) to find out the location from inside the applciation, the remaining difficulty is how to carry this information to the OO part we call.

The initialization is done within a lazy intializer as follows:

Code: Select all

	public static synchronized OpenOfficeContext getContext() throws OpenOfficeException {
		if (context == null) {
			try {
				context = new OpenOfficeContext(Bootstrap.bootstrap());
			} catch (BootstrapException e) {
				throw OpenOfficeException.wrap(e);
			}
		}
		return context;
	}
Is there another way to initialize the OO classes by passing the required environment variables or something equivalent?

Cheers,

Didier
OpenOffice 3.3.0
Windows XP, version 2002, service pack 3
Post Reply