How do I get OpenOffice to exit?

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
Tim Grantham
Posts: 32
Joined: Thu Jan 06, 2011 12:03 am

How do I get OpenOffice to exit?

Post 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.
OpenOffice 4.1
Windows 7 Professional
User avatar
RoryOF
Moderator
Posts: 34586
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: How do I get OpenOffice to exit?

Post 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.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: How do I get OpenOffice to exit?

Post by Villeroy »

Disable the "quick starter" and see if it is related to your problem.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Tim Grantham
Posts: 32
Joined: Thu Jan 06, 2011 12:03 am

Re: How do I get OpenOffice to exit?

Post by Tim Grantham »

Thanks, I'll try it.
OpenOffice 4.1
Windows 7 Professional
Post Reply