简体   繁体   English

如何将OpenOffice.org作为后台进程运行,以便将我的应用程序连接到使用UNO Java API?

[英]How do I run OpenOffice.org as a background process for connecting my application to using the UNO Java API?

Right now, I'm starting OpenOffice.org 3.3 with the arguments "-accept=socket,host=0,port=8100;urp;" 现在,我正在使用参数“-accept = socket,host = 0,port = 8100; urp;”启动OpenOffice.org 3.3。 using a shell script (.bat file on Windows, .sh file on Solaris). 使用shell脚本(Windows上的.bat文件,Solaris上的.sh文件)。 OpenOffice.org starts and the main screen appears (the one where you can select a document type, open a template, or open a file). OpenOffice.org启动并出现主屏幕(您可以选择文档类型,打开模板或打开文件)。 Eventually, this screen will be disabled, though - I see there are arguments for that purpose. 最终,这个屏幕将被禁用 - 我看到有这个目的的论据。

After starting OpenOffice.org, I can launch my application and create my document with the UNO API libraries for Java. 启动OpenOffice.org后,我可以启动我的应用程序并使用UNO API库创建我的文档。 At this point, both the OpenOffice.org main menu screen and my document are open. 此时,OpenOffice.org主菜单屏幕和我的文档都打开了。 However, when I close the document, the OpenOffice.org main menu screen also closes and the OpenOffice.org process terminates. 但是,当我关闭文档时,OpenOffice.org主菜单屏幕也会关闭,OpenOffice.org进程终止。 If I use my application to generate another document, it is unable to connect (because the soffice process is no longer running). 如果我使用我的应用程序生成另一个文档,则无法连接(因为soffice进程不再运行)。

My goal is to be able to start the process (or have it start with system startup, if the user configures it that way), have it sit until explicitly terminated, and contine accepting new generated documents. 我的目标是能够启动该过程(或者让它从系统启动开始,如果用户以这种方式配置它),让它保持直到明确终止,并且继续接受新生成的文档。

How can I get the desired the desired behavior? 如何获得所需的行为? Right now, my use case is that the soffice process is started from a shell script, however another use case is that soffice is configured to run on system startup. 现在,我的用例是soffice进程是从shell脚本启动的,但另一个用例是soffice配置为在系统启动时运行。 Is my behavior only possible with running the soffice process another way (as in on system startup, rather than executing via a batch script)? 我的行为是否只能以另一种方式运行soffice进程(如在系统启动时,而不是通过批处理脚本执行)? The only other option that I see (which I'm considering now) is to launch the OpenOffice.org process "on-demand" from my Java application, either start it from the Java application and terminate it when the Java application ends or launch the process every time I need to produce a new document. 我看到的唯一其他选项(我现在正在考虑)是从我的Java应用程序“按需”启动OpenOffice.org进程,从Java应用程序启动它并在Java应用程序结束或启动时终止它每次我需要生成一个新文档时的过程。

You can add the parmeters -invisible and -headless to the commandline when starting soffice.exe. 启动soffice.exe时,可以将-invisible-headless添加到命令行。

That will hide the main window when OOo - very similar to a "service". 这将隐藏OOo时的主窗口 - 非常类似于“服务”。

As far as I remember, opening a document will then not even display the OOo main window. 据我记得,打开文档甚至不会显示OOo主窗口。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何用Java修改OpenOffice.org绘制图? - How to modify an OpenOffice.org Draw diagram in Java? 如何从Java Uno应用程序关闭OpenOffice? - How to shutdown OpenOffice from my Java Uno application? 怎么可能没有 以编程方式获取OpenOffice.org电子表格中的页面数? - How can the no. of pages in an OpenOffice.org spreadsheet be obtained programmatically? Java OpenOffice UNO API:如何扩展电子表格文档? - Java OpenOffice UNO API: How to scale spreadsheet document? 如何在Java中以后台运行应用程序(进程) - How to run an application(process) in java as background 使用Openoffice Java API(UNO API)将整个ODT(Openoffice Writer)文档部分复制到其他文档 - Copy a whole ODT (Openoffice Writer) document section to other document with Openoffice Java API (UNO API) 将Java应用程序作为后台进程运行 - run java application as background process 如何使用zygote运行自己的Java进程? - How can i run my own java process using zygote? 如何从我的 Java 应用程序运行批处理文件? - How do I run a batch file from my Java Application? 仅当我的应用程序处于活动状态且在后台运行且未被破坏时,如何在后台运行 BLE 扫描? - How do I run a BLE scan in the background only if my application is alive and in the background as well and not destroyed?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM