Page 1 of 1

How do I get OpenOffice to exit?

Posted: Wed Mar 23, 2016 4:32 pm
by Tim Grantham
I'm running a Java UNO API app that launches OpenOffice Writer in headless mode, opens a couple of Writer docs, does some stuff to them, and then closes both docs.

Once OO has done what I want, it sometimes exits and sometimes it doesn't. I don't know why, but I want it to exit every time. How do I do this?

My API app is the only client to OO, so there's no reason to keep OO running.

Here is how my app finishes:

Code: Select all

{
            //...
           try {
               //...
               //Closing styled doc and exiting...
               if (xCloseableStyledDoc != null) {
                xCloseableStyledDoc.close(false);
               } else {
                xDoc.dispose();
               } catch (java.lang.Exception e) {
                     e.printStackTrace();
             }  finally {
                     System.exit(0);
             }
}
Advice very appreciated.

Thanks,
Tim.

Re: How do I get OpenOffice to exit?

Posted: Wed Mar 23, 2016 5:38 pm
by RoryOF
Try inserting a delay before the exit command. If this works you may have to fine tune the delay period to get consistent results.

Re: How do I get OpenOffice to exit?

Posted: Wed Mar 23, 2016 6:05 pm
by Villeroy
Disable the "quick starter" and see if it is related to your problem.

Re: How do I get OpenOffice to exit?

Posted: Wed Mar 23, 2016 6:49 pm
by Tim Grantham
Thanks, I'll try it.