OpenOffice.org UNO 客户端应用程序

另请参见

OpenOffice.org UNO 客户端应用程序是一个 Java 应用程序,用于提供对 OpenOffice.org API 的访问。该应用程序通过远程连接在其自身的应用程序中使用 OpenOffice.org 功能。典型的用例包括办公自动化任务,如下所示:

这种简单的 UNO 客户端应用程序要求在其运行的计算机上安装本地 OpenOffice.org,因为该应用程序将通过命名的管道连接与 OpenOffice.org 进程实现通信。该客户端应用程序会自动启动新的 OpenOffice.org 进程,或者如果 OpenOffice.org 进程已在运行,则连接该进程。如果未指定其他选项,则使用缺省的 OpenOffice.org 安装。

如果您希望使用特定的 OpenOffice.org 安装,则可以通过为系统属性 com.sun.star.lib.loader.unopath 指定 Office 安装来重载自动搜索算法。
例如:

java -Dcom.sun.star.lib.loader.unopath="/opt/staroffice8/program" -jar MyApplication.jar

UNO 客户端应用程序不要求运行特殊的环境。通过使用类加载器机制,可以自动准备所需的环境,该机制了解 OpenOffice.org 安装中所有必需的 API jar 文件。
客户端应用程序 jar 文件中包含 OpenOffice.org SDK 提供的一些预编译类文件和一个特定于 Microsoft Windows 的 dll;此外,还对清单进行扩展以使用特殊的加载器机制。包含的 dll 用于确保客户端应用程序与平台无关。

清单条目:

Main-Class: com.sun.star.lib.loader.Loader

Name: com/sun/star/lib/loader/Loader.class
Application-Class: TestMinimalComponent

捆绑的类 fclass 文件和 dll:

com/sun/star/lib/loader/Loader$CustomURLClassLoader.class
com/sun/star/lib/loader/Loader.class
com/sun/star/lib/loader/InstallationFinder$StreamGobbler.class
com/sun/star/lib/loader/InstallationFinder.class
com/sun/star/lib/loader/WinRegKey.class
com/sun/star/lib/loader/WinRegKeyException.class
win/unowinreg.dll

另请参见