How do I close a java<->OOo bridge?

Java, C++, C#, Delphi, ??? - Using the UNO bridges

How do I close a java<->OOo bridge?

Postby coolcaptcha » Fri Apr 23, 2010 10:44 am

Hi there,

I would like to close the bridge between Java and OOo without having to kill either program.

  • XComponent.dispose() alone makes the Java program hang after ending main (some connection reader thread is blocking)
  • System.exit(0) does not kill OOo but it stops (logically) the Java program.
  • XDesktop.terminate() kills OOo (even other open documents are being closed)
  • BootstrapPipeConnector.disconnect() kills open OOo as well.

Now I am out of ideas. Is there another way to close the bridge?
OOo 2.4 + Java6 on Debian Lenny
Posts: 1
Joined: Wed Apr 21, 2010 4:11 pm

Re: How do I close a java<->OOo bridge?

Postby craig_wu » Thu May 27, 2010 5:16 am

I have the same problem too. Even the java is terminated, the soffice process(tow processes as show below ) still running.
14803 pts/3 S 0:00 /bin/sh /opt/openoffice.org3/program/soffice -nologo -nodefault -norestore -nocrashreport -nolockcheck -accept=pipe,name=uno1583999052068028538;urp;
14863 pts/3 Sl 0:02 /opt/openoffice.org3/program/soffice.bin -nologo -nodefault -norestore -nocrashreport -nolockcheck -accept=pipe,name=uno1583999052068028538;urp;
OpenOffice 2.4 on Ubuntu 9.04
Posts: 1
Joined: Thu May 27, 2010 5:01 am

Re: How do I close a java<->OOo bridge?

Postby jrhillery » Sat Dec 09, 2017 6:25 pm

I recently ran into this problem. It's hard to find the right bridge. After much digging, I found the local service manager had a reference. Here is a method I wrote that closes the connection, leaving both processes running. It is safe to call even when there is no connection.
Code: Select all   Expand viewCollapse view
import static;

    * Close our connection to the office process.
   public static void closeOfficeConnection() {
      try {
         // get the bridge factory from the local service manager
         XBridgeFactory bridgeFactory = queryInterface(XBridgeFactory.class,

         if (bridgeFactory != null) {
            for (XBridge bridge : bridgeFactory.getExistingBridges()) {
               // dispose of this bridge after closing its connection
               queryInterface(XComponent.class, bridge).dispose();
      } catch (Throwable e) {
         System.err.println("Exception disposing office process connection bridge:");

   } // end closeOfficeConnection()
LibreOffice on Windows 10
Posts: 1
Joined: Sat Dec 09, 2017 5:59 pm

Return to External Programs

Who is online

Users browsing this forum: No registered users and 1 guest