Problems getting started! - bootstrapper connection problem

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
gringogordo
Posts: 6
Joined: Fri Apr 03, 2015 6:44 pm

Problems getting started! - bootstrapper connection problem

Post by gringogordo »

I'm trying to understand how to use the open office api / uno to open open office documents. I have installed the latest version of Open Office (4.1.1) onto Windows 7. I am using Java in Eclipse.

I have found a couple tutorials and Q & A's to do this and have fallen at the first hurdle.

I have added juh.far, jurt.jar, ridl.jar, unoil.jar in "C:\Program Files (x86)\OpenOffice 4\program\classes" to the build path and tried to run some basic code to connect

Code: Select all

// Get the remote office component context 
XComponentContext xContext = Bootstrap.bootstrap();
Doing this I got an error "no office executable found" as warned in the article. I tried adding the program folder to the build path although this seemed like the wrong thing to do (?) and it made no difference.

Googling this I found various articles along similar lines to this - viewtopic.php?t=2520.

And so I added the bootstrapconnector.jar file (looks like an old file ?)to the classes folder and added it to the build path and altered the code to

Code: Select all

(import ooo.connector.BootstrapSocketConnector;)

String oooExeFolder = "C:/Program Files (x86)/OpenOffice 4/program/";
XComponentContext xContext = BootstrapSocketConnector.bootstrap(oooExeFolder);
This now gives me a different error

exception is java.lang.NoClassDefFoundError: ooo/connector/BootstrapSocketConnector...

java.lang.ClassNotFoundException: ooo.connector.BootstrapSocketConnector...

Have I gone the wrong way or is this just a silly error (one thing that worries me is the import

import ooo.connector.BootstrapSocketConnector; is very different to the rest that I was using (or would like to use if I could get that far which all start

import com.sun.star.XXX

Can anyone help ?!
Cheers
Open Office 4.1 API
Post Reply