将openoffice3设置为windows服务

      前言:项目中需要用到openoffice将word转为pdf和html,具体见http://javatim.iteye.com/blog/803355 涉及启动openoffice的命令,由于在通过调用本地exe程序实在不知道如何判断已经启动完成,于是研究将启动设为windows服务。

       OpenOffice设置为windows服务

1 首先是安装openoffice了,再安装Windows Server 2003 Resource Kit Tools,注意安装目录,本教程安装在:C:\WindowsResourceKits\Tools;该目录在进行下一步骤时时必须写全路径的。Windows Server 2003 Resource Kit Tools下载地址 以及官方的exe可执行程序安装为服务的教程

2安装服务,打开windows命令行窗口执行如下命令:执行程序必须写全路径,中间服务名最好用引号引起来。C:\>c:\WindowsResourceKits\Tools\instsrv.exe "OpenOfficeService" c:\WindowsResourceKits\Tools\srvany.exe

3 进入注册表窗口 (在运行输入regedit)

    到此在注册表里面已经可以看到该服务项了。该服务注册表路径HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet \Services\OpenOfficeService

   关注ImagePath的值为:C:\WindowsResourceKits\Tools\srvany.exe;

   初始进来没有Parameters Enum

4 OpenOfficeService上新建“项”Parameters

5 Parameters新建字符串值Application,添入值:

C:\Program Files\OpenOffice.org 3\program\soffice.exe -headless -nofirststartwizard -accept="socket,host=localhost,port=8100;urp;StarOffice.Service"

设置完后,注册表路径如下:

 -OpenOfficeService 
                --Enum 
                --Security 
                --Parameters ( ---Application = "C:\Program....." )

6 在服务窗口设置为自动启动即可。

7 启动没问题,用以下命令测试openoffice是否在监听端口

netstat -anp tcp

附:soffice.exe参数说明

http://community.nuxeo.com/5.3/books/nuxeo-book/html/admin-openoffice.html

猜你喜欢

转载自ourteam.iteye.com/blog/1182485