XComponentContext xRemoteContext = getRemoteContext(xUrlResolver);
// get desktop to terminate office
Object desktop = xRemoteContext.getServiceManager().createInstanceWithContext("com.sun.star.frame.Desktop",xRemoteContext);
XDesktop xDesktop = (XDesktop) UnoRuntime.queryInterface(XDesktop.class, desktop);
xDesktop.terminate();
}
catch (Exception e) {
// Bad luck, unable to terminate office
}