Comments on: Getting started with the API part III : starting with jars not in the OOo install dir Friends of Oracle and Java Thu, 21 May 2015 20:49:51 +0000 hourly 1 By: Wouter van Reeven Wed, 01 Apr 2009 17:32:12 +0000 Hi all, I will take this article offline later this week. The reason is that this article is much outdated and there are great possibilities to achieve what’s described here using the plugin for NetBeans. I suggest you start using that.

Thanks, Wouter

By: martin joseph Thu, 12 Mar 2009 04:40:34 +0000 hai Wouter van Reeven,

First of let me thank u once again for spending a lot of your time for helping others
on such a topic where finding good documentation is so hard. I had previously read the
part ii of your article series where u helped me to insert bookmarks using open api

So … straight to my problem then . I did everything as u have said in this article .But my program
runs into an exception or something at the line

Object context = xUrlResolver.resolve( sConnect );

i think this is the same error that InchBinich was referring to …

could you help me rectify this …

i will tell u what i did till now

i subclassed Bootstrap class
and copied in the methods u had said ie (bootstrap method, createInitialComponentContext, insertBasicFactories,pipe methods) .I then changed the few lines of code u had said

Then i used the FirstUnoContact class shown in the developers guide .
In this class i specified the ooobase directory as u had said …

I am using windows xp os , open office org 2.4, netbeans 6.5

I had copied the 5 jar files u mentioned into a new folder and added them into my project in netbeans

Had i done something wrong .. or missed out on something ..

Hoping u will respond to my query ,
martin joseph

By: tanalyw Tue, 24 Feb 2009 02:19:20 +0000 Hi,

i tried the suggestion given above. However, it hanged when trying to resovle s2 in the bootstrap method. any idea?

By: yanot Thu, 13 Nov 2008 22:08:10 +0000 Hello all,
I spent nearly whole day trying to implement this stuff. Finally I got the same problem like described @vishal, @vbms, @srinivas, …
“java.lang.UnsatisfiedLinkError:;) etc.” (Windows XP and Solaris 10)
I read this article and discussion several times without success, but finally the following command (executed on Solaris) solved my problem:
“LD_LIBRARY_PATH=/opt/csw/$LD_LIBRARY_PATH java -jar myapplication.jar”
Hope it help to all other who have this problem (I hope this will fix this problem on Windows as well, but now I’m exhausted – I’ll test it tomorrow).

By: Vishal Mon, 27 Oct 2008 17:08:22 +0000 Hi,

I am using Solaris SPARC & trying to open word document using open office API. I did everything mentioned in your article/forum. But I am getting following error.

Exception in thread “main” java.lang.UnsatisfiedLinkError: createJNI
at Method)
at DocumentHandling.Bootstrap.bootstrap(

Can you let me know if Need solaris specific jar files? if yes from where can I download them?

By: xman Thu, 25 Sep 2008 16:14:59 +0000 Hi, I also spent half a day w/o any result. I try to create an Eclipse plug-in which shall create/modify a document. I always get an exception (BootstrapException: no office executable found!) when I call Bootstrap.bootstrap(). I added all jars from OOo/program/classes into the build-path which is actually defined in the MANIFEST.MF file. I added the path hard-coded (this is another thing I have to solve), e.g. “external:D:/Program Files/ 2.4/program/classes/juh.jar”.
BTW, I first created a simple Java app which includes all jars directly and that worked. But it does not work with the Eclipse plug-in.
Any hints?

By: site admin Mon, 02 Jun 2008 19:07:08 +0000 Hi Sean,

Sorry, I have no experience with this at all. AFAIK you’ll need the OfficeBean for this. For more info, see

the OOo OfficeBean

HTH, Wouter

P.S. This article has become obsolete now that there is a VERY GOOD OOo plugin for NetBeans. Please go and check it out!!!

By: sean Thu, 29 May 2008 16:29:08 +0000 Dear Wouter van Reeven and readers,
Thank you for your invaluable information. I have now managed to build and run one of examples supplied with the openoffice sdk. Without your help, it would have been looking very ugly.
They certainly don’t know how to make something easy to learn.
However, now I am trying to embed the writer in a normal java app, as a JFrame or so (rather than magically invoke oo writer application as a whole), and I have come a little stuck.
The example they so kindly provided (file:///usr/lib/openoffice/sdk/examples/java/EmbedDocument/EmbeddedObject) seems to provide an example JFrame object which can be used…
but no example on how to use it. In fact, hardly a kind comment at all in the code, and none describing arguments to functions etc. Not very nice.
Has anyone managed to do this properly?
What I have managed to get running so far only looks like an ugly Textpane .. with no proper colours, no menu, no buttons… no mouse listener .. no copy and paste…
I hardly think it is working at all….. So I have obviously done something wrong. But finding good documentation and examples on this … i am finding difficult. Or maybe i am just not a very good google searcher?
Can anyone help me?
All I want to achieve is this:
1. an open office window looking JFrame, with full menu and buttons and font selector etc. (no fancy changes, removing this, adding that)
2. implement a drag and drop listener on this ooJFrame, so that I can tailor the content dragged from one java component to this OO Component.
(i know how to do this in a normal java context…. is it the same in this circumstance?)

any pointers? Please!!!??!

By: hol.sten Sun, 03 Feb 2008 21:00:12 +0000 Hello Ichbinich, today I made the following observations, trying to get the above Bootstrap modifications working: First observation: Putting the JAR files juh.jar, jurt.jar, ridl.jar and unoil.jar into a directory outside OOo’s installation directory and modifying as written above does not suffice. My application terminated after executing “xUrlResolver.resolve(sConnect);”, too. Second observation: To get the modifications working is possible by using one of the following alternatives: 1) Put the ooBaseDirectory into the CLASSPATH. 2) Add -Djava.library.path=”C:/Programme/ 2.3/program” to the VM options (I got this idea from here: (mnasato explained the caveat of the pipe)). 3) Use juh.jar from the classes directory of ooBaseDirectory. 4) Use ridl.jar from the classes directory of ooBaseDirectory. 5) Don’t use a pipe at all and use a socket connection (change the -accept option to “-accept=socket,host=localhost,port=8100;urp;” and the connection string to “uno:socket,host=localhost,port=8100;urp;StarOffice.ComponentContext”). Using 1) OR 2) OR 3) OR 4) OR 5) does suffice. It is not necessary to combine several alternatives to get the modifications above working. My environment is OOo 2.3.1, Java 6 Update 4, NetBeans 6.0, Windows XP.

By: Ichbinich Sun, 03 Feb 2008 12:30:34 +0000 Hey.

After resolving all the errors by putting all the import things to the bootstrap I dont get an error in all my classes.

But when I now try to start the main class, the programm just terminates. I backtraced this with printStreams and the problem seems to be in this line:

267 Object context = xUrlResolver.resolve( sConnect );

in the bootstrap class. Something seems to be wrong with that line. Can you please give a hint how to solve this problem?

By: Wouter van Reeven Tue, 15 Jan 2008 14:08:48 +0000 Hi Heiko, we had a discussion about your problem via email. It turns out that you should make NetBeans NOT include the jar files in the lib dir of the project and that the project can be ran outside of NetBeans through the command ‘java -cp {OOo}\program\classes;dist\Test1.jar FirstUnoContact [input arguments]’. Greets, Wouter

By: Heiko Fri, 11 Jan 2008 15:05:28 +0000 Hi. You delivered a very good example of keeping and publishing solutions to common problems. Thank you for that. Unfortunately, I ran into the same problems as polly and srinivas. I started by “clicking together” some of the example files from the api.openoffice web page in NetBeans 6.0 under WinXP and used the building script from their “FirstUnoContact” example. In the debugger it works fine, but deploying doesn’t. It also doesn’t work to copy the .jar files to the OOo\program folder or specifying their location as classpath. I’m stuck.
But I read about a NetBeans integration package for the OpenOfficeSDK in their wiki. It should solve the issue. Still, it is not available for NetBeans 6. So I keep gnawing on my keyboard.
If you think you could give some more hints I can give a very detailed description of my configuration. I’m desperate to resolve this problem because the opportunities of using OOo in this way are so great.
Bye, Heiko

By: Wouter van Reeven Thu, 27 Dec 2007 10:04:58 +0000 Hi Tobias,

Sorry it took such a long time for me to reply to you. Please read my blog entry again. You need to copy the Bootstrap class code to a new class of your own and then modify the code in that class. If you have a look at the bootstrap method in the Bootstrap class you’ll see how to proceed and what to return.

HTH, Wouter

By: Tobias Pires Thu, 29 Nov 2007 18:32:31 +0000 This link explains:
But I do not understand well ! :(

I did this :

private static String sOffice = System.getProperty(“”).startsWith(“Windows”) ? “soffice.exe” : “soffice”;
File fOffice = NativeLibraryLoader.getResource(Bootstrap.class.getClassLoader(), sOffice);

public static final XComponentContext bootstrap(URLClassLoader loader){
File fOffice = NativeLibraryLoader.getResource(loader, sOffice);
return ????;

What do I have to do to continue ???

By: Matthias Roscher Tue, 06 Nov 2007 19:34:11 +0000 Hi, at first i will thank you for this, next I want catch some Events from OpenOffice , e.g. the close-event. Have you an Idea how i can realize that? thanks for your effort. Matthias