Friday, October 15, 2010

Running open office as a windows service

Humm I am wondering does this require a blog. But then when I think of it I feel yes there are so many users who might be feeling the pain.How many times do we come across situation where we want to use open office because it has all the features that MS OFFICE has, specially while programming in java this is a common scenario. Now to use open office the need is that open office runs all the times even when somebody is not logged in. I encountered one such instance and went through the pains to create open office as a service. It is pretty simple but there is a need to follow the steps in the right sequence. Detailing the steps below:

1. Install Open office on windows.

2. You need to get the windows resource kit and install it. This is a nice little utility because it allows us to create/remove services and also there are some utilities for windows which are very useful one of favourite :).

3. There is a command "INSTSRV" that can be used to create a service. This command allows the user to create a service and the service runs based on the parameters that are added in the registry. Open up an MS-DOS command prompt.

Type the following command: INSTSRV [service name] SRVANY.EXE
where [service name] is the name of the service you are setting up. The service name can be whatever you want, but should be descriptive.
Remove service example:
INSTSRV MyService REMOVE were "Myservice" is the service name.

2. Open up the Registry Editor (Click on the Start Button, select Run, and type REGEDIT)
3. Locate the following key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\[service name]
4. From the Edit menu, select New, select Key, and name the new key "Parameters"
Highlight the Parameters key
5. From the Edit menu, select New, select String Value, and name the new value Application
6. From the Edit menu, select Modify, and type in the full path name and application name, including the drive letter and file extension.

For example please find my entries below when i created the service
Application
"C:\Program Files (x86)\OpenOffice.org 3\program\soffice.exe"

The thing to keep in mind here is that folders like "Program Files" need to be put in quotes.

AppParameters
-headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard

This is a pretty important entry because it starts the open office without asking for license.
7. Close the Registry Editor.
8. Start the service and you are ready to go.

I hope these steps help ease the pains a little bit.